20041121, 19:45  #1 
2×3,853 Posts 
how do you find number of digits of a 2^n number?
hi all,
I found this program yesterday and i was thinking about how to tell how many digits are in a 2^n number if i knew n. I made a Microsoft Excel spreadsheet and calculated out about 40 sequences, and eventually found a pattern relating the n's that end in 0 (multiples of 10). my pattern was ((3/10)*n) + 1. for example, using 0 for n, the result (number of digits in 2^n) is 1, as it should be. using 10, 20, 30, and 40 for n, i get 4, 7, 10, 13 respectively. i checked the actual digits by doing the math on the calculator and counting digits, and the pattern works. i found this page http://www.utm.edu/research/primes/mersenne/index.html which showed a table of known mersenne primes. i tested my equation on the table, and got good results until n=1279. according to the chart, 2^n should have 386 digits. however, when i plugged it into my equation, i came up with 384 digits. each n after that also gave incorrect answers, and they get continually worse. for example, the 40th mersenne prime, 2^20996011 1 has 6,320,430 digits according to the chart, but only 6,298,804 digits according to my equation (i used n=20996010 to get the answer, because i found a pattern that shows that after a multiple of 10, the next 3 have the same amount of digits, followed by 3 with 1 more digit, another 3 with 2 more digits, and then the next multiple of 10 is reached). So, i was wondering how you guys got the number of digits in a 2^n number, and why my equation and the "known" digits are so far off. thanks in advance, michael p.s. if you don't understand what i wrote, say so and i'll try to clarify. 
20041121, 19:53  #2 
Jun 2004
UK
139 Posts 
floor(log 2 * n) + 1
Where log is base 10. 
20041121, 19:55  #3 
P90 years forever!
Aug 2002
Yeehaw, FL
7·1,051 Posts 
There are ceiling (n * log10(2)) digits. The base 10 log of 2 is .30103

20041121, 20:01  #4 
3·19·31 Posts 
ah, that makes sense. now i see why mine are so close at the beginning and then so far off later on.
but then, another quick questionwhat do floor and ceiling mean? 
20041121, 20:08  #5 
P90 years forever!
Aug 2002
Yeehaw, FL
7×1,051 Posts 
floor is round down. ceiling is round up.

20041121, 20:10  #6 
6364_{10} Posts 
ah, got it. thanks

20041122, 16:31  #7 
Sep 2002
1100010001_{2} Posts 
Are floor and ceiling terms simply the same thing as the boundaries of the logarithmic functions?

20041122, 19:39  #8 
Jun 2004
UK
139 Posts 
They're just "functions".
floor refers to the integer that is closest to a number without being higher. ceiling refers to the integer that is closest to a number without being lower. They're just fancy names for rounding up and rounding down. 
20041123, 05:30  #9 
Oct 2003
Australia, Brisbane
2×5×47 Posts 
I don't know about other languages.. but I know that I use floor and ceiling a lot in both excel and matlab. Both floor and ceiling are acual "functions" in both programs. However, I haven't actually ever seen floor or ceiling written in any maths textbooks as far as I can remember... I could be wrong though.

20041123, 09:08  #10  
Bamboozled!
"πΊππ·π·π"
May 2003
Down not across
2^{5}×331 Posts 
Quote:
floor(x) is represented by _ x _ and ceiling(x) has the horizontal lines at the top. Paul 

20041123, 18:02  #11 
"Richard B. Woods"
Aug 2002
Wisconsin USA
2^{2}×3×641 Posts 
See
http://mathworld.wolfram.com/FloorFunction.html and http://mathworld.wolfram.com/CeilingFunction.html for clear examples and fuller explanation. 
Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
who can help me factor this 155 digits number  sinide  Factoring  12  20101109 01:05 
who can factor this 128 digits number?  aaa120  Factoring  19  20100904 09:16 
Number Of Digits; I Hate To Ask  storm5510  Other Mathematical Topics  14  20100831 01:16 
Factoring 132digits Number  abc_temp  Factoring  14  20071223 20:25 
Number of digits display  grobie  15k Search  13  20050929 21:57 