Problem 72

前のオイラーのΦ関数を利用。

import Number
import Data.List
phi = product.map f.group.factors
where f ps@(p:_) = let n = length ps
in p^(n-1)*(p-1)
p072 d = foldl1' (+) .map phi$ [2..d]
main = print.p072$10^6
More Reading
Newer// Problem 71
Older// Problem 73