-
Notifications
You must be signed in to change notification settings - Fork 2
isPrime
Subhajit Sahu edited this page Aug 9, 2022
·
7 revisions
Check if bigint is prime.
Similar: properDivisors, primeFactors, primeExponentials, isPrime.
function isPrime(x)
// x: a bigint
const xbigint = require('extra-bigint');
xbigint.isPrime(7n);
// → true
xbigint.isPrime(53n);
// → true
xbigint.isPrime(4n);
// → false
xbigint.isPrime(1n);
// → false
xbigint.isPrime(0n);
// → false