Skip to content

Instantly share code, notes, and snippets.

@syusui-s
Created March 4, 2013 06:32
Show Gist options
  • Save syusui-s/5080393 to your computer and use it in GitHub Desktop.
Save syusui-s/5080393 to your computer and use it in GitHub Desktop.
Project Euler in Haskell - Haskellの練習のためなので、結構適当
p1 = sum [x | x <- [1..999], x `mod` 3 == 0 || x `mod` 5 == 0])
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