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