properDivisors - nodef/extra-math GitHub Wiki

List all divisors of a number, except itself.

Similar: properDivisors, aliquotSum, isPrime.

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


xmath.properDivisors(6);
// → [1, 2, 3]

xmath.properDivisors(1);
// → []

xmath.properDivisors(0);
// → []

xmath.properDivisors(-24);
// → [1, 2, 3, 4, 6, 8, 12]

References