Jump to content

Looking for specific software

Hogger

I'm looking for a programming software that will let me do calculations. Basically, I love numbers, and I want to program a calculation.... My train of thought went like this... we count 60 seconds, 60 minutes, 24 hours, and 365 days... why didn't they use a power of 10 I wonder... (I don' really care that much about that) But then I shifted my thought to "how many times would you add up 365 to be a power of 10". I want it to be able to find "the power of 10" (that being the number of additions to get a power of 10) of any number, along with any future programs.

 

So, in a very basic chain of commands...

 

[This is my first thought of the program]     n in both situations is the number you are testing for the power of 10

 

1) set x = 0

2) set Y = 1 + (runs - 1)

3) add Yn to x

4) if x does NOT = 1 x 10^z then repeat steps with Y = Y+1 (this is my notes, but basically, add 1 to the value of runs)

5) if x = 1 x 10^z STOP

 

[but my simpler version is this]

 

1) set x = 1^# of runs

2) perform x/n

3) if x/n does NOT = whole number, repeat steps but multiply # of runs counter by 10

3) if x/n = whole number STOP

Link to comment
Share on other sites

Link to post
Share on other sites

Microsoft excel?

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, deXxterlab97 said:

Microsoft excel?

Does that have the ability to repeat processes over and over looking for a specific type of answer??? I was thinking brackets or python in the back of my mind. But if excel can do the trick, I'm all for it

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Hogger said:

Does that have the ability to repeat processes over and over looking for a specific type of answer??? I was thinking brackets or python in the back of my mind. But if excel can do the trick, I'm all for it

Could try learn some programming language. I could already thing of some code lines in C or Pascal

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, deXxterlab97 said:

Could try learn some programming language. I could already thing of some code lines in C or Pascal

I am completely new to programming (besides some html and VEX edr robots). any good place to start? khan academy maybe????

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Hogger said:

I am completely new to programming (besides some html and VEX edr robots). any good place to start? khan academy maybe????

tutorials point maybe. or w3schools. I don't know much lol

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, deXxterlab97 said:

tutorials point maybe. or w3schools. I don't know much lol

gotcha, thanks for the input! 

Link to comment
Share on other sites

Link to post
Share on other sites

13 hours ago, Hogger said:

I am completely new to programming (besides some html and VEX edr robots). any good place to start? khan academy maybe????

Look for Learn Ruby the Hard Way. I used to play a lot with math using Ruby. 

 

I should've sticked to Ruby. :(

Link to comment
Share on other sites

Link to post
Share on other sites

Mathematical computation and ease of use/learning go hand in hand with Python. I would recommend starting here.

Link to comment
Share on other sites

Link to post
Share on other sites

Any programming language will suit your needs.

C,Python,Ruby,Matlab/Octave,javascript, java, you name it.

 

Still, what are you asking exactly?

I have the number 365 and I want to multiply it by another number so that the result will be a power of 10? An exact power of ten, so that 365*z=10n (for z integer)? Well, that's never going to happen, it's simple mathematics. 365=5*73, and 10n=2n*5n. You will be able to find a z such that 365*z ≡ 0 (mod 10n) pretty easily, meaning that it will be divisible by a power of 10, but you will not get it to be an exact power of 10 since there's no way you're getting rid of that prime factor of 73. Unless x = 1/73 * something, but we're looking for integers so that doesn't work.

 

With that out of the way, I see you want to generalize your question for any integer x. You could just keep searching for it until you find your answer but we can come up with a better solution.

Let's rephrase the problem. Given an integer x, you want to find an integer z such that x*z=10for any integer n. We specifically want to find z for which n is minimum.

As per our previous example, if x contains any other prime factors other than 2 and 5, then there is no such number z.

If x is of the form 2a*5b,, then we can get it to be equal to 10max(a,b) really easily. And there is no smaller power of 10 with the property we're looking for.

2a*5b*z=10max(a,b)

2a*5b*z=2max(a,b)*5max(a,b)

z=2max(a,b)-a*5max(a,b)-b

 

So instead of a brute force search, we just have to do the prime factorization of our number. But we don't even have to do that either. We just need to find out the powers of 2 and 5 in the number and if there's any other factor in it. So if the number is divisible by 2 and 5 respectively, we divide it by 2 and 5 respectively until it isn't divisible anymore. If the remaining number is 1, then it is of the form 2a*5b. If it isn't 1 then there are some other prime factors in it and we won't be able to find any solution to that situation. Final complexity will be O(a+b), where a is the power of the factor 2 in the number and b the same thing but for 5. Much better.

 

Pseudocode will look something like this :

a=b=0

while x is divisible by 2:
	x = x/2
	a = a+1
while x is divisible by 5:
	x = x/5
	b = b+1
if x not equal to 1:
	there is no solution
else:
	solution will be z=2^(max(a,b)-a)*5^(max(a,b)-b)

 

i5 4670k @ 4.2GHz (Coolermaster Hyper 212 Evo); ASrock Z87 EXTREME4; 8GB Kingston HyperX Beast DDR3 RAM @ 2133MHz; Asus DirectCU GTX 560; Super Flower Golden King 550 Platinum PSU;1TB Seagate Barracuda;Corsair 200r case. 

Link to comment
Share on other sites

Link to post
Share on other sites

3 hours ago, Nineshadow said:

Any programming language will suit your needs.

C,Python,Ruby,Matlab/Octave,javascript, java, you name it.

 

Still, what are you asking exactly?

I have the number 365 and I want to multiply it by another number so that the result will be a power of 10? An exact power of ten, so that 365*z=10n (for z integer)? Well, that's never going to happen, it's simple mathematics. 365=5*73, and 10n=2n*5n. You will be able to find a z such that 365*z ≡ 0 (mod 10n) pretty easily, meaning that it will be divisible by a power of 10, but you will not get it to be an exact power of 10 since there's no way you're getting rid of that prime factor of 73. Unless x = 1/73 * something, but we're looking for integers so that doesn't work.

 

With that out of the way, I see you want to generalize your question for any integer x. You could just keep searching for it until you find your answer but we can come up with a better solution.

Let's rephrase the problem. Given an integer x, you want to find an integer z such that x*z=10for any integer n. We specifically want to find z for which n is minimum.

As per our previous example, if x contains any other prime factors other than 2 and 5, then there is no such number z.

If x is of the form 2a*5b,, then we can get it to be equal to 10max(a,b) really easily. And there is no smaller power of 10 with the property we're looking for.

2a*5b*z=10max(a,b)

2a*5b*z=2max(a,b)*5max(a,b)

z=2max(a,b)-a*5max(a,b)-b

 

So instead of a brute force search, we just have to do the prime factorization of our number. But we don't even have to do that either. We just need to find out the powers of 2 and 5 in the number and if there's any other factor in it. So if the number is divisible by 2 and 5 respectively, we divide it by 2 and 5 respectively until it isn't divisible anymore. If the remaining number is 1, then it is of the form 2a*5b. If it isn't 1 then there are some other prime factors in it and we won't be able to find any solution to that situation. Final complexity will be O(a+b), where a is the power of the factor 2 in the number and b the same thing but for 5. Much better.

 

Pseudocode will look something like this :


a=b=0

while x is divisible by 2:
	x = x/2
	a = a+1
while x is divisible by 5:
	x = x/5
	b = b+1
if x not equal to 1:
	there is no solution
else:
	solution will be z=2^(max(a,b)-a)*5^(max(a,b)-b)

 

after a little thinking... would 1x10^365 give a power of 10 divisible by 365??? I feel like it would. it makes some sense that it would

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×