Skip to content

isPrime

Subhajit Sahu edited this page Aug 8, 2022 · 1 revision

Check if number is prime.

Similar: properDivisors, aliquotSum, isPrime.


function isPrime(x)
// x: a number

const xmath = require('extra-math');


xmath.isPrime(7);
// → true

xmath.isPrime(53);
// → true

xmath.isPrime(4);
// → false

xmath.isPrime(1);
// → false

xmath.isPrime(0);
// → false


References

Clone this wiki locally