Skip to content

properDivisors

Subhajit Sahu edited this page Aug 8, 2022 · 1 revision

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

Clone this wiki locally