The second Project Euler problem - Even Fibonacci Numbers - is stated as follows - By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
// Generate a sequence thar produces the Fibonacci numbers. // Fn = Fn-1 + Fn-2 let sequence = Seq.unfold (fun (a,b) -> Some( a+b, (b, a+b) ) ) (0,1) let sum = sequence // Keep even numbers. |> Seq.filter (fun n -> n % 2 = 0) // Only take the values below four million. |> Seq.takeWhile (fun n -> n < 4000000) // Return the sum of the elements in the sequence. |> Seq.sum printfn "%i" sum