primeFactors - nodef/extra-bigint GitHub Wiki

Find the prime factors of a bigint.

Similar: minPrimeFactor, maxPrimeFactor, primeFactors. Similar: properDivisors, primeFactors, primeExponentials, isPrime.

function primeFactors(x)
// x: a bigint
const xbigint = require('extra-bigint');


xbigint.primeFactors(1n);
// → []

xbigint.primeFactors(3n);
// → [3n]

xbigint.primeFactors(21n);
// → [3n, 7n]

xbigint.primeFactors(55n);
// → [5n, 11n]

xbigint.primeFactors(53n);
// → [53n]

References