Is Mersenne Number - Maple Help

Home : Support : Online Help : Mathematics : Number Theory : Queries : Is Mersenne Number

NumberTheory

 IsMersenne
 test whether a number is a Mersenne number

 Calling Sequence IsMersenne(n)

Parameters

 n - positive integer

Description

 • The IsMersenne(n) command returns $\mathrm{true}$ if ${2}^{n}-1$ is prime, $\mathrm{false}$ if ${2}^{n}-1$ is not prime, and $\mathrm{FAIL}$ if the status is unknown.
 • Cases where the status is unknown will generally take an extremely long time to return an answer.
 • If ${2}^{n}-1$ is prime, then it is said to be a Mersenne prime.
 • There are currently 51 known Mersenne primes.
 • For every composite number $m$, ${2}^{m}-1$ is a not a prime.

Examples

 > $\mathrm{with}\left(\mathrm{NumberTheory}\right):$
 > $\mathrm{IsMersenne}\left(2\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{IsMersenne}\left({3}^{36458}\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{isprime}\left(60298361\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{IsMersenne}\left(60298361\right)$
 ${\mathrm{FAIL}}$ (4)
 > $\mathrm{IsMersenne}\left(60298362\right)$
 ${\mathrm{false}}$ (5)

The Tabulate command can be used to display Mersenne primes in a grid. The following table highlights any Mersenne primes with a pink background.

 > $V≔\left(r,c\right)↦\mathrm{DocumentTools}:-\mathrm{Tabulate}\left(\mathrm{Matrix}\left(r,c,\left(i,j\right)↦c\cdot \left(i-1\right)+j\right),\mathrm{fillcolor}=\left(\left(T,i,j\right)↦\mathrm{if}\left(\mathrm{IsMersenne}\left(c\cdot \left(i-1\right)+j\right),"Pink","White"\right)\right)\right):$
 > $V\left(10,10\right)$
 ${"Tabulate"}$ (6)

 $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$ $50$ $51$ $52$ $53$ $54$ $55$ $56$ $57$ $58$ $59$ $60$ $61$ $62$ $63$ $64$ $65$ $66$ $67$ $68$ $69$ $70$ $71$ $72$ $73$ $74$ $75$ $76$ $77$ $78$ $79$ $80$ $81$ $82$ $83$ $84$ $85$ $86$ $87$ $88$ $89$ $90$ $91$ $92$ $93$ $94$ $95$ $96$ $97$ $98$ $99$ $100$

Note that V(r, c) can be modified to show tables for various values of r and c.

Compatibility

 • The NumberTheory[IsMersenne] command was introduced in Maple 2016.