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)$
 $\left[\right]$ (9)