EgisonLib - lib/math/project-euler.egi : Utility functions to solve project euler problems
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/math
README.md
install.sh
uninstall.sh

README.md

Utility Functions to solve Project Euler

Usage

% egison -l lib/math/project-euler.egi
> (num-to-digits 12345)
{1 2 3 4 5}
> (digits-to-num {1 2 3 4 5})
12345

Function List

sum-of-positive-divisors

> (sum-of-positive-divisors 3)
4     ; 1+3
> (sum-of-positive-divisors 12)
28    ; 1+2+3+4+6+12

sum-of-proper-divisors

> (sum-of-proper-divisors 3)
1
(sum-of-proper-divisors 12)
16    ; 1+2+3+4+6

num-to-digits

> (num-to-digits 12345)
{1 2 3 4 5}

digits-to-num

> (digits-to-num {1 2 3 4 5})
12345

LICENSE

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.