-
Notifications
You must be signed in to change notification settings - Fork 0
minPrimeFactor
Subhajit Sahu edited this page Aug 9, 2022
·
1 revision
Find the least prime number which divides a number.
Similar: minPrimeFactor, maxPrimeFactor, primeFactors.
function minPrimeFactor(x)
// x: a number
const xnumber = require('extra-number');
xnumber.minPrimeFactor(1);
// → 0
xnumber.minPrimeFactor(3);
// → 3
xnumber.minPrimeFactor(21);
// → 3
xnumber.minPrimeFactor(55);
// → 5
xnumber.minPrimeFactor(53);
// → 53