+0  
 
0
799
3
avatar+39 

Teacher asked me some time ago if there´s a way for this:

I have this: 500000000000000000000

how can I express this in a form of power of a number (something to power of something)? Note that I don´t want to get the exact result, I want to only get the RANGE 5xxxxxxxxxxxxxxxxxxxx.

Thanks.

 Jan 7, 2020
 #1
avatar
+1

Well, you can express it in any number of ways:

500 000 000 000 000 000 000 =5E20 or 5 x 10^20 or 6^26.6 .......etc.

 Jan 7, 2020
 #2
avatar+39 
+1

thanks, but this isn´t exactly I´m looking for. I mean this:

546516546654461986448

how can I quickly compute which power gives me 5XXXXXXXXXXXXXXXXXXXX? X-random value, but that doesn´t matter - I want to give the length.

 Jan 8, 2020
 #3
avatar+118687 
+2

I am not sure ywhat you are asking. 

I think you are asking for a little program to find the power when it is written in scientific notation?

 

How about having a counter.

 

1    counter      c=0

2     number      n=50000000000000000000000   (or whatever the original number is)

3   Test: Is the number n less than 10?

4   If yes, then n is the power and END

 

5    If no, then add 1 to counter

6    replace n with  n divided by 10  

7     Go to step 3

 

I have not checked my logic thoroughly but that seems like a good outling of a little program that will do this

 Jan 15, 2020

1 Online Users

avatar