Created
December 31, 2011 00:00
-
-
Save dmalikov/1542128 to your computer and use it in GitHub Desktop.
Project Euler 214 (190s)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PECore (eulerTotient) | |
import Data.Numbers.Primes | |
import Control.Arrow ((&&&)) | |
eulerChains :: Integer -> Integer | |
eulerChains 1 = 1 | |
eulerChains n = 1 + eulerChains (eulerTotient n) | |
main = print . sum . map fst . filter ( (== 25) . snd ) . map ((&&&) id eulerChains) . takeWhile (<40000000) $ primes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment