Skip to content

isPrime

Subhajit Sahu edited this page Aug 9, 2022 · 3 revisions

Check if number is prime.

Similar: properDivisors, primeFactors, primeExponentials, isPrime.


function isPrime(x)
// x: a number

const xnumber = require('extra-number');


xnumber.isPrime(7);
// → true

xnumber.isPrime(53);
// → true

xnumber.isPrime(4);
// → false

xnumber.isPrime(1);
// → false

xnumber.isPrime(0);
// → false


References

Clone this wiki locally