mersenneforum.org Number of digits in prime
 Register FAQ Search Today's Posts Mark Forums Read

2022-05-30, 17:13   #1
storm5510
Random Account

Aug 2009
Not U. + S.A.

22·7·83 Posts
Number of digits in prime

Quote:
 Originally Posted by odicin Added 133982 : 993*2^1717566-1 (517042 digits) on port 2000
A little known program call mprint can generate the expression above. The order has to be different before it will accept it. "2^1717566-1*993" without the quotes.

This must be longer than 517,042 digits. Log(2) * 1717566 = 517,039. This is without the exponentiation, multiplication, and the subtraction of 1. I captured mprint's output to a file. It is 6,535,835 bytes in length. There are no extra characters beyond a CRLF at the end which accounts for only two bytes. mprint wrote it all as a single line. Only Notepad++ could open it.

 2022-05-30, 22:38 #2 kar_bon     Mar 2006 Germany 3×991 Posts Using pfgw with Code: pfgw64 -od -q"993*2^1717566-1" >prime.txt puts out the number in decimal expansion in a file of 517,097 bytes: including the expression in front and some spaces at the end. Deleting those will give the exact 517,042 digits (using only the standard Editor in WIN). The number of digits you can also use WolframAlpha.
2022-05-31, 02:45   #3
VBCurtis

"Curtis"
Feb 2005
Riverside, CA

5,471 Posts

Quote:
 Originally Posted by storm5510 This must be longer than 517,042 digits. Log(2) * 1717566 = 517,039. This is without the exponentiation, multiplication, and the subtraction of 1.
How many digits will multiplying by 993 add? Hint: 3. How many digits will subtracting 1 add?

I mean, you did the hard work to get 517,039... it boggles my mind that you faceplant when trying to get from there to 517,042.

 2022-05-31, 05:23 #4 retina Undefined     "The unspeakable one" Jun 2006 My evil lair 11001110001002 Posts Python also agrees: Code: >>> len(str(993*2**1717566-1)) 517042
 2022-05-31, 14:48 #5 storm5510 Random Account     Aug 2009 Not U. + S.A. 22·7·83 Posts OK. I will take your word for it. No dispute. . . It appears mprint assumes "2^" in front. What I actually did was 2^2^..... Running mprint without parameters produces this: Code: USAGE: mprint p [base] [perfect] Outputs 2^p-1 in base base to stdout If you add the third parameter, it outputs 2^(p-1)*2^(p-1) Yes, "base" appears twice in the second line. Oh well, more of a curiosity than anything else.
 2022-05-31, 15:08 #6 ATH Einyen     Dec 2003 Denmark 17×199 Posts mprint only print Mersenne numbers 2p-1 but can print it in different bases for example decimal, hexidecimal etc. To get the number of digits in k*bn + c: First ignore "+ c" unless c is HUGE and/or b and n are very very small. log (k*bn) = log(k) + n*log(b) In your case: log10(993*2^1717566-1) = log10(993) + 1717566*log10(2) ~ 3 + 1717566*log10(2) In general: log(a*b) = log(a) + log(b) and log(ab) = b*log(a) Last fiddled with by ATH on 2022-05-31 at 15:09
2022-05-31, 16:49   #7
kruoli

"Oliver"
Sep 2017
Porta Westfalica, DE

114010 Posts

Quote:
 Originally Posted by storm5510 Yes, "base" appears twice in the second line.
This likely means in "base {value of parameter [base]}" and that's why it is written twice.

2022-05-31, 17:45   #8
a1call

"Rashid Naimi"
Oct 2015
Remote to Here/There

1000111011112 Posts

Code:
\\ I learned this from SM. In PARI-GP
allocatemem()
allocatemem()
allocatemem()
allocatemem()
length(Str(2^82589933 - 1))
##
Quote:
 (13:41) gp > \\ I learned this from SM. In PARI-GP (13:41) gp > allocatemem() *** Warning: new stack size = 16000000 (15.259 Mbytes). (13:41) gp > allocatemem() *** Warning: new stack size = 32000000 (30.518 Mbytes). (13:41) gp > allocatemem() *** Warning: new stack size = 64000000 (61.035 Mbytes). (13:41) gp > allocatemem() *** Warning: new stack size = 128000000 (122.070 Mbytes). (13:41) gp > length(Str(2^82589933 - 1)) %1 = 24862048 (13:41) gp > ## *** last result computed in 8,767 ms.

Largest known prime number

2^82,589,933 - 1
The Great Internet Mersenne Prime Search (GIMPS) has discovered the largest known prime number, 2^82,589,933 - 1, having 24,862,048 digits.

51st known Mersenne prime found | Announce - News

Last fiddled with by a1call on 2022-05-31 at 17:45

2022-06-01, 07:33   #9
kar_bon

Mar 2006
Germany

3·991 Posts

Quote:
 Originally Posted by storm5510 Code: USAGE: mprint p [base] [perfect] Outputs 2^p-1 in base base to stdout If you add the third parameter, it outputs 2^(p-1)*2^(p-1) Yes, "base" appears twice in the second line.
The perfect number of a Mersenne prime 2p-1 should read as 2p-1*(2p-1) instead.

2022-06-01, 20:15   #10
Batalov

"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

2×4,967 Posts

Quote:
 Originally Posted by kar_bon Using pfgw with Code: pfgw64 -od -q"993*2^1717566-1" >prime.txt
pfgw64 -od -q"{this or many other forms, including U(), gcd() etc}" | awk '{print length(\$2)}'
and done
___________________
Quote:
Quote:
 Originally Posted by storm5510 Code: USAGE: mprint p [base] [perfect] Outputs 2^p-1 in base base to stdout If you add the third parameter, it outputs 2^(p-1)*2^(p-1) Yes, "base" appears twice in the second line.
The perfect number of a Mersenne prime 2p-1 should read as 2p-1*(2p-1) instead.
This shows care much care was put into mprint program. Simply don't use it; use better and much more developed tools: python, Pari/gp, pfgw and so on.

 Similar Threads Thread Thread Starter Forum Replies Last Post sweety439 sweety439 74 2022-05-17 19:28 bur And now for something completely different 13 2021-09-23 01:32 enzocreti enzocreti 1 2020-01-16 18:23 a1call Miscellaneous Math 179 2015-11-12 14:59 Unregistered Math 11 2004-11-30 22:53

All times are UTC. The time now is 08:55.

Sun Sep 25 08:55:56 UTC 2022 up 38 days, 6:24, 0 users, load averages: 1.11, 1.38, 1.25