lucas-lehmer-test

4.0.1 • Public • Published

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 valueth 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.

/lucas-lehmer-test/

    Package Sidebar

    Install

    npm i lucas-lehmer-test

    Weekly Downloads

    1

    Version

    4.0.1

    License

    MIT

    Unpacked Size

    3.63 kB

    Total Files

    4

    Last publish

    Collaborators

    • kenan