Skip to content
/ fermat Public

Fermat's probabilistic primality test

License

Notifications You must be signed in to change notification settings

kenany/fermat

Repository files navigation

fermat

Fermat's probabilistic primality test.

Example

const fermat = require('fermat');

fermat(7);
// => true

fermat(561);
// => true (not actually prime though)

Installation

$ npm install fermat

API

const fermat = require('fermat');

fermat(n)

Returns true if n is probably prime. Returns false otherwise. n can be either a Number or a String.