mersenneforum.org How many digits?
 Register FAQ Search Today's Posts Mark Forums Read

 2009-10-31, 16:25 #1 kokakola   Oct 2009 3 Posts How many digits? If I'm working on an LL test of N = 2^48,000,000 - 1, for example, is there any way for me to find how many digits N has? Thanks!
 2009-10-31, 16:55 #2 Mini-Geek Account Deleted     "Tim Sorbera" Aug 2006 San Antonio, TX USA 102668 Posts (with p being the exponent, the p in 2^p-1) The exact number is int(log_10(2^p)+1) = int(log_10(2)*p+1), which is roughly 0.3*p. Your example has exactly 14449440 (14.4 million) digits. http://mersenne-aries.sili.net/digits.php calculates log_10(2^N), or the reverse (enter the digits to find the bits). int(n) means the integer part of n. (e.g. int(4.8)=int(4.2)=int(4)=4) log_10(2) is the base 10 logarithm of 2. (i.e. 10^(log_10(2))=2; it's about 0.3) Last fiddled with by Mini-Geek on 2009-10-31 at 17:03
2009-10-31, 17:20   #3
kokakola

Oct 2009

3 Posts

Quote:
 Originally Posted by Mini-Geek (with p being the exponent, the p in 2^p-1) The exact number is int(log_10(2^p)+1) = int(log_10(2)*p+1), which is roughly 0.3*p. Your example has exactly 14449440 (14.4 million) digits. http://mersenne-aries.sili.net/digits.php calculates log_10(2^N), or the reverse (enter the digits to find the bits). int(n) means the integer part of n. (e.g. int(4.8)=int(4.2)=int(4)=4) log_10(2) is the base 10 logarithm of 2. (i.e. 10^(log_10(2))=2; it's about 0.3)
Thank you! Your formula is exactly what I was looking for.

2009-10-31, 17:37   #4
R.D. Silverman

"Bob Silverman"
Nov 2003
North of Boston

23·3·311 Posts

Quote:
 Originally Posted by kokakola If I'm working on an LL test of N = 2^48,000,000 - 1, for example, is there any way for me to find how many digits N has? Thanks!
How much math have you had? Normally, one sees logarithms in
the 2nd or (maybe) 3rd year of high school algebra.

2009-10-31, 18:34   #5
CRGreathouse

Aug 2006

3×1,993 Posts

Quote:
 Originally Posted by R.D. Silverman How much math have you had? Normally, one sees logarithms in the 2nd or (maybe) 3rd year of high school algebra.
High schools offer three years of algebra?

But I agree, logs are a high school topic.

2009-10-31, 19:39   #6
Mini-Geek
Account Deleted

"Tim Sorbera"
Aug 2006
San Antonio, TX USA

427810 Posts

Quote:
 Originally Posted by CRGreathouse But I agree, logs are a high school topic.
True, but being able to connect the dots to realize that the exact formula for the number of digits in a number of the form 2^p-1 is int(log_10(2)*p+1) is not exactly what you learn when learning basic logarithms. Basic logarithmic theory would suggest that it's about log_10(2^p)=log_10(2)*p, but to recognize the problem as related to logarithms and rederive the exact formula would be a bit more difficult than you all seem to imply. And this is all assuming the OP has even learned logarithms.

2009-11-01, 00:42   #7
CRGreathouse

Aug 2006

3·1,993 Posts

Quote:
 Originally Posted by Mini-Geek True, but being able to connect the dots to realize that the exact formula for the number of digits in a number of the form 2^p-1 is int(log_10(2)*p+1) is not exactly what you learn when learning basic logarithms. Basic logarithmic theory would suggest that it's about log_10(2^p)=log_10(2)*p, but to recognize the problem as related to logarithms and rederive the exact formula would be a bit more difficult than you all seem to imply. And this is all assuming the OP has even learned logarithms.
I have no argument with any of that, and would add the possibility that the OP learned it and forgot it.

2009-11-01, 04:20   #8
kokakola

Oct 2009

3 Posts

Quote:
 Originally Posted by R.D. Silverman How much math have you had? Normally, one sees logarithms in the 2nd or (maybe) 3rd year of high school algebra.
I have taken a number of college level math courses. As others have pointed out, I just didn't make the connection.

 2009-11-01, 20:05 #9 joblack     Oct 2008 n00bville 2·5·73 Posts There is somewhere in the forum a Windows program which calculates the exact value ... search for it
2009-11-01, 20:55   #10
CRGreathouse

Aug 2006

10111010110112 Posts

Quote:
 Originally Posted by joblack There is somewhere in the forum a Windows program which calculates the exact value ... search for it
That strikes me as overkill, since you can just as easily find it using Google as a calculator.

2009-11-01, 21:57   #11
R.D. Silverman

"Bob Silverman"
Nov 2003
North of Boston

164508 Posts

Quote:
 Originally Posted by Mini-Geek True, but being able to connect the dots to realize that the exact formula for the number of digits in a number of the form 2^p-1 is int(log_10(2)*p+1) is not exactly what you learn when learning basic logarithms.
Of course it is! Change of base is fundamental. I saw all of this,
IN CLASS in the 8th grade. i.e. the last year BEFORE high school.

Solving 2^x = 10^z is fundamental! It is totally trivial.

Last fiddled with by R.D. Silverman on 2009-11-01 at 21:57 Reason: typo

 Similar Threads Thread Thread Starter Forum Replies Last Post davar55 Puzzles 36 2015-12-18 15:47 storm5510 Math 7 2009-09-08 04:14 davar55 Puzzles 5 2007-06-18 15:06 marthamm GMP-ECM 4 2006-01-25 17:32 ndpowell Math 18 2005-07-15 22:31

All times are UTC. The time now is 01:00.

Mon Aug 15 01:00:43 UTC 2022 up 38 days, 19:48, 2 users, load averages: 0.92, 1.03, 1.05