Sum of Divisors Calculator

Enter a whole number to find the sum of all its divisors and its aliquot sum.

How it is calculated

The tool loops i from 1 to ⌊√n⌋. Whenever n mod i = 0, it adds i and its partner n / i to the total, adding the partner only once when the two are equal (a perfect square). That total is σ(n), the sum of all positive divisors including 1 and n. The second output is the aliquot sum, σ(n) − n, the sum of the divisors excluding n itself. The input must be a whole number from 1 to 100 000 000; zero, negatives, decimals and larger values return no result. For n = 1 the sum is 1 and the aliquot sum is 0. The tool does not label the number as perfect, abundant or deficient; compare the aliquot sum with n to decide.

Worked example

Take n = 36. Step 1: its divisors are 1, 2, 3, 4, 6, 9, 12, 18 and 36. Step 2: add them, 1 + 2 + 3 + 4 + 6 + 9 + 12 + 18 + 36 = 91. Check with the prime factorisation 36 = 2² × 3²: (1 + 2 + 4) × (1 + 3 + 9) = 7 × 13 = 91. Step 3: subtract 36 to get the aliquot sum, 91 − 36 = 55. Because 55 is larger than 36, the number is abundant.

Try this example →

Common mistakes

  • Mixing up the two outputs. The divisor sum includes n; the aliquot sum leaves it out, so the second is always smaller by n.
  • Forgetting that 1 and n both count. For a prime such as 97 the divisor sum is 98, and the aliquot sum is 1.
  • Testing for a perfect number by comparing the divisor sum with n. A perfect number has a divisor sum of 2n, so compare the aliquot sum with n instead: for 28 the aliquot sum is 28 (and the divisor sum 56).
  • Counting a repeated divisor twice. For 36 the square root 6 is added only once.
  • Expecting the tool to say perfect, abundant or deficient. It gives numbers only.

About this calculator

The sigma function, written σ(n), sums every positive divisor of a whole number n, including 1 and n itself, so σ(6) = 1 + 2 + 3 + 6 = 12. Subtracting n from that total gives the aliquot sum, the sum of n's divisors excluding n itself, a distinction that dates back to ancient Greek number theory and Euclid's study of what he called perfect numbers.

A number is classified as perfect when its aliquot sum equals the number itself (6 and 28 are the first two), abundant when the aliquot sum exceeds the number, and deficient when it falls short, classifications still used today in recreational and elementary number theory, and the sigma function itself reappears in more advanced settings such as the study of amicable number pairs and certain primality-related cryptographic computations.

Enter a whole number and this calculator returns the sum of all its positive divisors along with its aliquot sum. It does not label the number, but you can classify it yourself by comparing the aliquot sum with the number you entered.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators