Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Euler Problem 2(1)
// Recursive solution
let eulerProblem2Answer'' =
let maxF = 4000000
let rec computeSum f1 f2 sum =
match f1 + f2 with
| n -> computeSum f2 n sum
| n when n%2 = 0 -> if (n<maxF) then (computeSum f2 n (sum+n)) else sum
computeSum 0 1 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment