20080831, 01:05  #1 
Jun 2003
Ottawa, Canada
3·17·23 Posts 
Mersenne Prime # of Digits Calculator
Most of you here already know how to calculate this but for those of you that don't, I threw together a quick program that will calculate the number of decimal digits in a specified Mersenne number (2^p1).
There are Windows binaries available (GUI and command line), plus source code for the command line version to compile on Linux/Unix systems. You can download the software from: http://gilchrist.ca/jeff/MprimeDigits/ Jeff. 
20080831, 02:58  #2 
6809 > 6502
"""""""""""""""""""
Aug 2003
101×103 Posts
2^{2}×3×5×167 Posts 
Great idea. Maybe someone can throw together a Java version of this.
Last fiddled with by Uncwilly on 20080831 at 02:58 
20080831, 03:18  #3 
Undefined
"The unspeakable one"
Jun 2006
My evil lair
3^{3}·233 Posts 
Also, maybe do the reverse, allow the user to enter the decimal digits and compute the binary equivalent.

20080831, 07:30  #4  
"Robert Gerbicz"
Oct 2005
Hungary
5×13×23 Posts 
Quote:
Code:
Mersenne Prime # Digits Calculator v1.0 [Aug. 30, 2008] by Jeff Gilchrist (http://gilchrist.ca/jeff/) This program will calculate the number of decimal digits in the specified Mersenne number 2^p1. Enter the value of p to calculate: 100000000000000000039 Number of decimal digits in 2^77662796314522419591 is: 2337883123781333504 

20080831, 07:43  #5 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
2×4,787 Posts 
This tool can also be used (with minor modifications) to calculate number of Mb in a harddrivemaker's Terabyte and/or Gigabyte, and maybe even number of millions of bytes in a Mb. Just don't take my comment too seriously. It is a useful tool.

20080831, 08:08  #6  
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
2×4,787 Posts 
Quote:
Code:
<HTML><HEAD><TITLE>Conversion Exponent/Digits JavaScript</TITLE> <META httpequiv=ContentType content="text/html; charset=windows1251"> <SCRIPT language=JavaScript> <! function DigitsExp(){document.convert.Digits.value = document.convert.Exponent.value*0.301029995664;} function ExpDigits(){document.convert.Exponent.value = document.convert.Digits.value/0.301029995664;} //> </SCRIPT> <META content="MSHTML 6.00.6000.16705" name=GENERATOR></HEAD> <BODY text=#fExpDigitsc03 vLink=#ffffff link=#ffffff bgColor=#000000> <CENTER> <TABLE cellPadding=5 border=1><TBODY><TR><TD> <FORM name=convert> <H1>Mersenne Prime Digits</H1> <INPUT onblur=DigitsExp(); onfocus="document.convert.Digits.value='';" maxLength=10 size=10 value=0 name=Exponent> <FONT size=+2>Exponent</FONT> <INPUT onclick=DigitsExp(); type=button value=">>"> <INPUT onclick=ExpDigits(); type=button value="<<"> <FONT size=+2>Digits</FONT> <INPUT onblur=ExpDigits(); onfocus="document.convert.Exponent.value='';" maxLength=10 size=10 name=Digits> </FORM></TR></TBODY> </TABLE> </BODY> </HTML> 

20080831, 15:40  #7 
Sep 2002
662_{10} Posts 
A Delphi (Pascal) Windows console mode version.
It agrees with a ubasic version for the first 18 digits after that it just it puts zeros, at least with a 20 digit p. With p <= 18 digits the results agree with the numbers I've tested. Delphi : Enter the value of p in 2^p  1 (with p maximum 18 digits, for good results) : 100000000000000000039 2^100000000000000000000  1 has 30102999566398119500 decimal digits. UBasic : Enter the value of p in 2^p  1 (with p maximum xx digits, for good results) : ? 100000000000000000039 2^ 100000000000000000039  1 has 30102999566398119532 decimal digits. Code:
Program BiDecDig; var power2 : extended; power10 : extended; x : extended; y : extended; z : extended; s : string; begin power2 := 32582657.0; // The example value used in the 1st post in the thread writeln('Enter the value of p in 2^p  1'); write ('(with p maximum 18 digits, for good results) : '); readln(power2); x := ln(2.0); y := ln(10.0); z := ((x/y) * power2) + 1.0; power10 := int(z); writeln('2^',power2:0:0,'  1 has ',power10:0:0,' decimal digits.'); readln(s); end. Code:
100 print "Enter the value of p in 2^p  1" 110 input "(with p maximum xx digits, for good results) : ";Power2 120 X=log(2) 140 Y=log(10) 160 Z=((X/Y)*Power2)+1.0 180 Power10=fix(Z) 200 print "2^";Power2;" 1 has";Power10;"decimal digits." I don't have any way to test it. Delphi source and executable and UBasic source are in the attachment BiDecDig.zip Last fiddled with by dsouza123 on 20080831 at 15:41 
20080901, 00:56  #8 
Jun 2003
Ottawa, Canada
3·17·23 Posts 
It is not really broken, more that it only supports 64bit integers so the largest p value you can enter is: 18446744073709551616
Luckily I didn't leave it as 32bit ints. Are you trying to figure out what kind of primes your great grandchildren will be testing? Jeff. 
20080901, 02:04  #9 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
22546_{8} Posts 
I think what we need now is a parody on the "programmer's progression" joke (the Hello World program progression from Basic to Fortan, Algol, Pascal, Cobol, PL/SQL, Ada and brainf*ck ... and beyond)
Who is game to write the BF implementation? 
20080901, 13:11  #10 
"Lucan"
Dec 2006
England
194A_{16} Posts 
Personally speaking, a conversion factor of log_{10}2
serves my purposes well enough. 
20080901, 15:43  #11  
"Robert Gerbicz"
Oct 2005
Hungary
5·13·23 Posts 
Quote:
for example: p=28505944177 (this p is prime) or for p=198096465 (this p is composite) gives bad number of digits for 2^p1 Last fiddled with by R. Gerbicz on 20080901 at 15:44 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Ten Billion Digits Mersenne Numbers  aketilander  Operation Billion Digits  14  20210227 07:14 
Mersenne Digits Curiosity  davar55  Lounge  11  20130208 15:19 
Program to TF Mersenne numbers with more than 1 sextillion digits?  Stargate38  Factoring  24  20111103 00:34 
Who is LLing a mersenne number > 100M digits?  joblack  LMH > 100M  1  20091008 12:31 
Digits of Pi in Mersenne Prime?  Unregistered  Miscellaneous Math  3  20040409 15:31 