mersenneforum.org > Math how do you find number of digits of a 2^n number?
 Register FAQ Search Today's Posts Mark Forums Read

 2004-11-21, 19:45 #1 Unregistered   1,667 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.
 2004-11-21, 19:53 #2 marc     Jun 2004 UK 139 Posts floor(log 2 * n) + 1 Where log is base 10.
 2004-11-21, 19:55 #3 Prime95 P90 years forever!     Aug 2002 Yeehaw, FL 1BEA16 Posts There are ceiling (n * log10(2)) digits. The base 10 log of 2 is .30103
 2004-11-21, 20:01 #4 Unregistered   22·233 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 question--what do floor and ceiling mean?
 2004-11-21, 20:08 #5 Prime95 P90 years forever!     Aug 2002 Yeehaw, FL 2×32×397 Posts floor is round down. ceiling is round up.
 2004-11-21, 20:10 #6 Unregistered   19·277 Posts ah, got it. thanks
 2004-11-22, 16:31 #7 Jwb52z     Sep 2002 11000000012 Posts Are floor and ceiling terms simply the same thing as the boundaries of the logarithmic functions?
 2004-11-22, 19:39 #8 marc     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.
 2004-11-23, 05:30 #9 dave_0273     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.
2004-11-23, 09:08   #10
xilman
Bamboozled!

"πΊππ·π·π­"
May 2003
Down not across

72×11×19 Posts

Quote:
 Originally Posted by dave_0273 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.
In printed text the floor and ceiling functions are generally written as partial square brackets. I don't know that I can include the characters here, but they look something like this:

floor(x) is represented by |_ x _| and ceiling(x) has the horizontal lines at the top.

Paul

 2004-11-23, 18:02 #11 cheesehead     "Richard B. Woods" Aug 2002 Wisconsin USA 22×3×641 Posts See http://mathworld.wolfram.com/FloorFunction.html and http://mathworld.wolfram.com/CeilingFunction.html for clear examples and fuller explanation.

 Similar Threads Thread Thread Starter Forum Replies Last Post sinide Factoring 12 2010-11-09 01:05 aaa120 Factoring 19 2010-09-04 09:16 storm5510 Other Mathematical Topics 14 2010-08-31 01:16 abc_temp Factoring 14 2007-12-23 20:25 grobie 15k Search 13 2005-09-29 21:57

All times are UTC. The time now is 13:29.

Fri Sep 18 13:29:55 UTC 2020 up 8 days, 10:40, 1 user, load averages: 2.48, 2.08, 1.86