Skip to content

aliquotSum

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

Sum all proper divisors of a number.

Similar: properDivisors, aliquotSum, isPrime.


function aliquotSum(x)
// x: a number

const xmath = require('extra-math');


xmath.aliquotSum(6);
// → 6 (1+2+3)

xmath.aliquotSum(1);
// → 0

xmath.aliquotSum(0);
// → 0

xmath.aliquotSum(-24);
// → 36 (1+2+3+4+6+8+12)


References

Clone this wiki locally