|
| 1 | +# Aliquot Sum |
| 2 | + |
| 3 | +The aliquot sum $s(n)$ of a positive integer $n$ is the sum of all proper divisors of $n$, that is, all divisors of $n$ other than the number $n$ itself. That is: |
| 4 | + |
| 5 | +$$ s(n) = \sum_{d | n, d \neq n} {d} $$ |
| 6 | + |
| 7 | +So, for example, the aliquot sum of the number $15$ is $(1 + 3 + 5) = 9$ |
| 8 | + |
| 9 | +Aliquot sum is a very useful property in Number Theory, and can be used for defining: |
| 10 | +- Prime Numbers |
| 11 | +- Deficient Numbers |
| 12 | +- Abundant Numbers |
| 13 | +- Perfect Numbers |
| 14 | +- Amicable Numbers |
| 15 | +- Untouchable Numbers |
| 16 | +- Aliquot Sequence of a number |
| 17 | +- Quasiperfect & Almost Perfect Numbers |
| 18 | +- Sociable Numbers |
| 19 | + |
| 20 | +## Facts about Aliquot Sum |
| 21 | +- 1 is the only number whose aliquot sum is 0 |
| 22 | +- The aliquot sums of perfect numbers is equal to the numbers itself |
| 23 | +- For a [*semiprime*](https://en.wikipedia.org/wiki/Semiprime) number of the form $pq$, the aliquot sum is $p + q + 1$ |
| 24 | +- The Aliquot sum function was one of favorite topics of investigation for the world famous Mathematician, [Paul Erdős](https://en.wikipedia.org/wiki/Paul_Erd%C5%91s) |
| 25 | + |
| 26 | +## Approach on finding the Aliquot sum |
| 27 | + |
| 28 | +### Step 1: *Obtain the proper divisors of the number* |
| 29 | +We loop through all the numbers from $1$ to $[\frac{n} 2]$ and check if they divide $n$, which if they do we add them as a proper divisor. |
| 30 | + |
| 31 | +The reason we take the upper bound as $[\frac{n} 2]$ is that, the largest possible proper divisor of an even number is $\frac{n} 2 $, and if the number is odd, then its largest proper divisor is less than $[\frac{n} 2]$, hence making it a foolproof upper bound which is computationally less intensive than looping from $1$ to $n$. |
| 32 | + |
| 33 | +### Step 2: *Add the proper divisors of the number* |
| 34 | +The sum which we obtain is the aliquot sum of the number |
| 35 | + |
| 36 | +## Implementations |
| 37 | +- [C#](https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorithms/Numeric/AliquotSumCalculator.cs) |
| 38 | +- [Java](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/maths/AliquotSum.java) |
| 39 | +- [JavaScript](https://github.com/TheAlgorithms/JavaScript/blob/master/Maths/AliquotSum.js) |
| 40 | +- [Python](https://github.com/TheAlgorithms/Python/blob/master/maths/aliquot_sum.py) |
| 41 | +- [Ruby](https://github.com/TheAlgorithms/Ruby/blob/master/maths/aliquot_sum.rb) |
| 42 | + |
| 43 | +## Sources |
| 44 | +- [Wikipedia](https://en.wikipedia.org/wiki/Aliquot_sum) |
| 45 | +- [GeeksForGeeks](https://www.geeksforgeeks.org/aliquot-sum/) |
0 commit comments