mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-13 17:50:45 +08:00
[fix/docs]: fit armstrong_number.cpp to guidelines (#2457)
* fix: fit armstrong_number.cpp to guidelines * chore: delete unnecessary whitespace * updating DIRECTORY.md * fit: aliquot_sum to contribution guidelines added a math formula * chore: add print statement mentioning tests have passed * Update math/armstrong_number.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update math/armstrong_number.cpp Co-authored-by: David Leal <halfpacho@gmail.com> --------- Co-authored-by: github-actions[bot] <github-actions@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
@@ -3,10 +3,18 @@
|
||||
* @brief Program to return the [Aliquot
|
||||
* Sum](https://en.wikipedia.org/wiki/Aliquot_sum) of a number
|
||||
*
|
||||
* \details
|
||||
* The Aliquot sum s(n) of a non-negative integer n is the sum of all
|
||||
* @details
|
||||
* The Aliquot sum \f$s(n)\f$ 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.
|
||||
* For example, the Aliquot sum of 18 = 1 + 2 + 3 + 6 + 9 = 21
|
||||
*
|
||||
* Formula:
|
||||
*
|
||||
* \f[
|
||||
* s(n) = \sum_{d|n, d\neq n}d.
|
||||
* \f]
|
||||
*
|
||||
* For example;
|
||||
* \f$s(18) = 1 + 2 + 3 + 6 + 9 = 21 \f$
|
||||
*
|
||||
* @author [SpiderMath](https://github.com/SpiderMath)
|
||||
*/
|
||||
@@ -19,8 +27,9 @@
|
||||
* @namespace math
|
||||
*/
|
||||
namespace math {
|
||||
|
||||
/**
|
||||
* Function to return the aliquot sum of a number
|
||||
* @brief to return the aliquot sum of a number
|
||||
* @param num The input number
|
||||
*/
|
||||
uint64_t aliquot_sum(const uint64_t num) {
|
||||
@@ -63,6 +72,5 @@ static void test() {
|
||||
*/
|
||||
int main() {
|
||||
test(); // run the self-test implementations
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user