`numlib`::`mersenne`

Mersenne primes

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

```numlib::mersenne(`n`)
numlib::mersenne()
```

Description

`numlib::mersenne()` returns the list of known Mersenne primes `p`. For these numbers, the Mersenne number 2p - 1 is prime.

`numlib::mersenne(n)` returns the `n`th currently known Mersenne prime. The numbers of the Mersenne primes after the 40th prime can change in the future. More Mersenne primes might be found.

Examples

Example 1

The following primes p are known to have the property that the Mersenne number 2p - 1 is prime:

`numlib::mersenne()`

Example 2

Display the `10`th Mersenne prime:

`numlib::mersenne(10)`

Return Values

Natural number or a list of natural numbers.

References

See `http://www.mersenne.org/`

Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos