Created
March 4, 2013 06:32
-
-
Save syusui-s/5080393 to your computer and use it in GitHub Desktop.
Project Euler in Haskell - Haskellの練習のためなので、結構適当
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
| p1 = sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0]) |
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
| next a = [last a]++[sum (take 2 (reverse a))] | |
| funct a = if (fst a)!!1<4000000 then funct(next(fst a),if (fst a)!!1`mod`2==0 then (snd a)+(fst a)!!1 else (snd a)) else a | |
| p2 = snd(funct([1,2],0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment