1
0
Fork 0
projecteuler/72.hs

7 lines
195 B
Haskell
Raw Permalink Normal View History

2017-07-03 17:51:27 +00:00
import Math.NumberTheory.Primes.Factorisation
totient :: Integer -> Integer
totient n = foldr (\(p, _) acc -> acc * (p-1) `div` p) n $ factorise n
main = print $ sum $ map totient [2..1000000]