maxPrimeFactor - nodef/extra-math GitHub Wiki

Find the greatest prime number which divides a number.

Similar: minPrimeFactor, maxPrimeFactor, primeFactors.

function maxPrimeFactor(x)
// x: a number
const xmath = require('extra-number');


xmath.maxPrimeFactor(1);
// → 0

xmath.maxPrimeFactor(3);
// → 3

xmath.maxPrimeFactor(21);
// → 7

xmath.maxPrimeFactor(55);
// → 11

xmath.maxPrimeFactor(53);
// → 53

References