|  | TheAlgorithms/C++ 1.0.0
    All the algorithms implemented in C++ | 
Program to return the Aliquot Sum of a number. More...
#include <cassert>#include <cstdint>#include <iostream>Go to the source code of this file.
| Namespaces | |
| namespace | math | 
| for assert | |
| Functions | |
| uint64_t | math::aliquot_sum (const uint64_t num) | 
| to return the aliquot sum of a number | |
| static void | test () | 
| Self-test implementations. | |
| int | main () | 
| Main function. | |
Program to return the Aliquot Sum of a number.
The Aliquot sum \(s(n)\) of a non-negative integer n is the sum of all proper divisors of n, that is, all the divisors of n, other than itself.
Formula:
\[ s(n) = \sum_{d|n, d\neq n}d. \]
For example; \(s(18) = 1 + 2 + 3 + 6 + 9 = 21 \)
Definition in file aliquot_sum.cpp.
| int main | ( | void | ) | 
Main function.
Definition at line 74 of file aliquot_sum.cpp.
| 
 | static | 
Self-test implementations.
Definition at line 57 of file aliquot_sum.cpp.