Skip to content

Instantly share code, notes, and snippets.

@mmitou
Created October 1, 2012 08:45
Show Gist options
  • Save mmitou/3810377 to your computer and use it in GitHub Desktop.
Save mmitou/3810377 to your computer and use it in GitHub Desktop.
project euler 2
-- フィボナッチ数列の項は前の2つの項の和である。 最初の2項を 1, 2 とすれば、最初の10項は以下の通りである。
-- 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
-- 数列の項の値が400万を超えない範囲で、偶数値の項の総和を求めよ。
fibo = 1:2:(zipWith (+) (tail fibo) fibo)
euler2 = sum . filter even . takeWhile (< 4000000) $ fibo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment