Euler Problem 2(1)
This file contains 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
// 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