Skip to content

minPrimeFactor

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

Find the least prime number which divides a number.

Similar: minPrimeFactor, maxPrimeFactor, primeFactors.


function minPrimeFactor(x)
// x: a number

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


xmath.minPrimeFactor(1);
// → 0

xmath.minPrimeFactor(3);
// → 3

xmath.minPrimeFactor(21);
// → 3

xmath.minPrimeFactor(55);
// → 5

xmath.minPrimeFactor(53);
// → 53


References

Clone this wiki locally