M136279841 found
![]()
A new largest prime number was discovered a few days ago on Oct 11, 2024 by Luke Durant 1.
Get hyped
If you aren’t excited about math or don’t already geek out about prime numbers, then you may benefit from first watching Adam Spencer’s TED talk. Yes, give a chance to a talk titled “Why I fell in love with monster prime numbers.” 2
Especially if you have ever wondered whether primes have a hype man. :-D
Some properties of $2^{136279841}-1$
So what do we know about this number? For starters it is a Mersenne prime, which has the form $M_p = 2^p-1$.
Note $p$ is also prime.
>>> M136279841 = 2**136_279_841 - 1
>>> type(M136279841)
<class 'int'>
>>> M136279841.bit_length()
136279841
Python’s built-in int type supports arbitrarily large integers, which is convenient for manipulating this massive number.
>>> from sympy.ntheory.primetest import isprime
>>> exponent = 136_279_841
>>> isprime(exponent)
True
Quick test that the exponent $p$ is prime with isprime from SymPy 3.
Check decimal digits
Need to disable the default denial-of-service (DoS) protection for CVE-2020-10735 4.
>>> import sys
>>> sys.set_int_max_str_digits(0)
>>> _M136279841 = str(M136279841)
>>> len(_M136279841)
41024320
Yup, it really does have 41 million decimal digits 5. Also, the int to string conversion took about 30 seconds, which confirms the DoS potential.
>>> _M136279841[:120]
'881694327503833265553939100378117358971207354509066041067156376412422630694756841441725990347723283108837509739959776874'
>>> _M136279841[-120:]
'852806517931459412567957568284228288124096109707961148305849349766085764170715060409404509622104665555076706219486871551'
>>>
While I’m here, double-check the first and last 120 digits of its value.
Write digits to file
>>> with open("M136279841.txt", "w") as f:
... f.write(_M136279841)
...
41024320
>>>
$ du -sh M136279841.txt
40M M136279841.txt
$ head -c120 M136279841.txt
881694327503833265553939100378117358971207354509066041067156376412422630694756841441725990347723283108837509739959776874
$ tail -c120 M136279841.txt
852806517931459412567957568284228288124096109707961148305849349766085764170715060409404509622104665555076706219486871551
$
File weighs in at an impressive 40 MB.
![]()
To further establish a sense of scale, Wikipedia tells us that it would take “10,940 single-sided pages to print this prime number, or approximately 22 reams of paper (15 are shown here).”
Now that’s a big number!
I am tempted to dust off an old computer, grab a copy of prime95, and see what the state of the art in primality testing is these days.
– JW
Footnotes
-
Some media coverage from Popular Mechanics at https://www.popularmechanics.com/science/math/a62695223/biggest-prime-number/. ↩
-
Whenever I study math I am reminded of something Mr. Spencer says, “In a room full of randomly selected people, I am a math genius. In a room full of maths PhDs I am as dumb as a box of hammers.” ↩
-
See https://docs.sympy.org/latest/modules/ntheory.html#sympy.ntheory.primetest.isprime for
isprimeAPI documentation from SymPy. ↩ -
See https://docs.python.org/3/library/stdtypes.html#integer-string-conversion-length-limitation for further detail on limiting conversion size and CVE-2020-10735. ↩
-
Wikipedia tells us there are 41,024,320 digits and the first and last 120 digits of its value. See https://en.wikipedia.org/wiki/Largest_known_prime_number. ↩