1234567891011121314151617 |
- #!/usr/bin/ruby
- # Author: Daniel "Trizen" Șuteu
- # Date: 15 August 2016
- # License: GPLv3
- # Website: https://github.com/trizen
- # https://projecteuler.net/problem=72
- # Runtime: 3.661s (previously 5.425s)
- func count_frac(n) {
- sum(2..n, {|k| euler_totient(k) })
- }
- say count_frac(1e6)
|