|
Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Program to return the Aliquot Sum of a number. More...
#include <cassert>#include <iostream>Namespaces | |
| namespace | math |
| for IO operations | |
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 \)
| int main | ( | void | ) |
|
static |
Self-test implementations.