The 42nd Mersenne Prime

Eric W. Weisstein

On February 18, 2005, a member of the GIMPS project discovered the 42nd known Mersenne prime.  Evaluate the cell below to caculate its value.

mersenne42=2^25964951 - 1;

Evaluate the cell below to calculate the decimal digits of the prime.

digits=IntegerDigits[mersenne42];//Timing

Evaluate the cell below to compute the number of decimal digits in the prime.

Length[digits]

Evaluate the cell below to see the first and last few digits

ToString[FromDigits[Take[digits,20]]]<>"⋯"<>ToString[FromDigits[Take[digits,-20]]]

Evaluate the following to compute the number of times each decimal digit appears.

counts=Length/@Split[Sort[digits]]

Evaluate the following to generate a nicely formatted table showing the distribution of digits.

DisplayForm[GridBox[
MapIndexed[{#2[[1]]-1,#1}&,counts],GridFrame->True,RowLines->True,ColumnLines->True]]

As can be seen, 6 is the rarest digit, and 9 is the most common.  Evaluate the cell below to show a ranked list of digits by frequency, with the rarest digit appearing first.

Ordering[counts]-1

There are 7,816,230 digits.  Evaluate the cell below to verify that the above counts sum to the total number of digits.

Plus@@counts

Evaluate the cell below to see the full prime

mersenne42

The original algorithm for finding large Mersenne primes was developed in Mathematica by Richard Crandall.  At www.perfsci.com, the product "PrimeKit" is available, which is a precise, one-to-one collection of notebooks for the algorithms in the Crandall and Pomerance's book	Prime Numbers: A Computational Perspective. The IBDWT algorithm is discussed there, and other informationabout the book can be obtained from http://library.wolfram.com/infocenter/Books/953/.