Problem 72
This commit is contained in:
parent
33a0bdc69f
commit
9efc3acd17
|
@ -0,0 +1,6 @@
|
|||
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]
|
Loading…
Reference in New Issue