Learn R Programming

numbers (version 0.8-5)

mersenne: Mersenne Numbers

Description

Determines whether \(p\) is a Mersenne number, that is such that \(2^p - 1\) is prime.

Usage

mersenne(p)

Value

Returns TRUE or FALSE, indicating whether p is a Mersenne number or not.

Arguments

p

prime number, not very large.

Details

Applies the Lucas-Lehmer test on p. Because intermediate numbers will soon get very large, uses `gmp' from the beginning.

References

https://mathworld.wolfram.com/Lucas-LehmerTest.html