In number theory, 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 n itself.
They are defined by the sums of their aliquot divisors. The aliquot divisors of a number are all of its divisors except the number itself. The aliquot sum is the sum of the aliquot divisors so, for example, the aliquot divisors of 12 are 1, 2, 3, 4, and 6 and it’s aliquot sum is 16.
A number whose aliquot sum equals its value is a PERFECT number (6 for example).
Input : 12 Output : 16 Explanation : Proper divisors of 12 is = 1, 2, 3, 4, 6 and sum 1 + 2 + 3 + 4 + 6 = 16 Input : 15 Output : 9 Explanation : Proper divisors of 15 is 1, 3, 5 and sum 1 + 3 + 5 = 9
A simple solution is to traverse through all numbers smaller than n. For every number i, check if i divides n. If yes, we add it to result.
- Aliquot Sequence
- Sum of numbers in a range [L, R] whose count of divisors is prime
- Find a pair (n,r) in an integer array such that value of nPr is maximum
- Sum of values of all possible non-empty subsets of the given array
- Find a pair (n,r) in an integer array such that value of nCr is maximum
- Minimum length String with Sum of the alphabetical values of the characters equal to N
- Printing the Triangle Pattern using last term N
- Minimize the cost of partitioning an array into K groups
- Find next greater element with no consecutive 1 in it's binary representation
- Number of ways in which N can be represented as the sum of two positive integers
- Random list of M non-negative integers whose sum is N
- Number of ways to erase exactly one element in the Binary Array to make XOR zero
- Minimum absolute difference between N and any power of 2
- Maximum possible number with the given operation
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : jit_t