lucas-lehmer-test
v4.0.1
Published
Lucas-Lehmer primality test
Downloads
17
Readme
lucas-lehmer-test
Lucas-Lehmer primality test in JavaScript. This is the primality test that is used by the Great Internet Mersenne Prime Search to locate large primes, and has done a pretty good job of finding some of the largest primes to date.
Example
Is the 31st Mersenne number a prime number?
var lucasLehmerTest = require('lucas-lehmer-test');
lucasLehmerTest(31);
// => true
Installation
$ npm install lucas-lehmer-test
API
var lucasLehmerTest = require('lucas-lehmer-test');
lucasLehmerTest(value)
Uses the Lucas-Lehmer primality test to determine if the value
th Mersenne
number is a prime number. Returns true
if it is; otherwise returns false
.
value
can be a Number (it most cases it probably will be), a String (for
really large numbers that JavaScript has a hard time with), or an instance of
big-integer.