Mersenne Primes - Maple Help

Number Theory: Mersenne Primes

Getting Started

While any command in the package can be referred to using the long form, for example, NumberTheory:-IsMersenne, it is often easier to load the package and then use the short form command names.

 > restart;
 > with(NumberTheory):

Examples

Mersenne Primes are prime numbers that are one less than a power of 2. These are of the form:  ${M}_{n}={2}^{n}-1$, where $n$ is a positive integer. The IthMersenne command returns the exponent for the Ith Mersenne prime number:

 > $\mathrm{IthMersenne}\left(4\right)$
 ${7}$ (1)
 > ${2}^{7}-1$
 ${127}$ (2)

The top level isprime command determines if a given number is prime:

 > $\mathrm{isprime}\left({2}^{7}-1\right)$
 ${\mathrm{true}}$ (3)

The IsMersenne command checks if a positive integer, n, is a Mersenne exponent, where 2^n-1 is a Mersenne prime:

 > ${2}^{2}-1$
 ${3}$ (4)
 > $\mathrm{IsMersenne}\left(2\right)$
 ${\mathrm{true}}$ (5)
 > ${2}^{11}-1$
 ${2047}$ (6)
 > $\mathrm{IsMersenne}\left(11\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{ifactor}\left({2}^{11}-1\right)$
 $\left({23}\right){}\left({89}\right)$ (8)

There are 49 known Mersenne Primes.

 > $\mathrm{interface}\left(\mathrm{rtablesize}=52\right):$
 > $\mathrm{DataSeries}\left(\left[\mathrm{seq}\left(\mathrm{IthMersenne}\left(i\right),i=1..49\right)\right],\mathrm{labels}=\left[\mathrm{seq}\left(1..49\right)\right]\right)$
 ${\mathrm{DataSeries}}{}\left(\left[\begin{array}{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr}2& 3& 5& 7& 13& 17& 19& 31& 61& 89& 107& 127& 521& 607& 1279& 2203& 2281& 3217& 4253& 4423& 9689& 9941& 11213& 19937& 21701& 23209& 44497& 86243& 110503& 132049& 216091& 756839& 859433& 1257787& 1398269& 2976221& 3021377& 6972593& 13466917& 20996011& 24036583& 25964951& 30402457& 32582657& 37156667& 42643801& 43112609& 57885161& 74207281\end{array}\right]{,}{\mathrm{labels}}{=}\left[{1}{,}{2}{,}{3}{,}{4}{,}{5}{,}{6}{,}{7}{,}{8}{,}{9}{,}{10}{,}{11}{,}{12}{,}{13}{,}{14}{,}{15}{,}{16}{,}{17}{,}{18}{,}{19}{,}{20}{,}{21}{,}{22}{,}{23}{,}{24}{,}{25}{,}{26}{,}{27}{,}{28}{,}{29}{,}{30}{,}{31}{,}{32}{,}{33}{,}{34}{,}{35}{,}{36}{,}{37}{,}{38}{,}{39}{,}{40}{,}{41}{,}{42}{,}{43}{,}{44}{,}{45}{,}{46}{,}{47}{,}{48}{,}{49}\right]{,}{\mathrm{datatype}}{=}{\mathrm{anything}}\right)$ (9)