Skip to content

Instantly share code, notes, and snippets.

@ssg
Created January 17, 2011 20:47
Show Gist options
  • Save ssg/783450 to your computer and use it in GitHub Desktop.
Save ssg/783450 to your computer and use it in GitHub Desktop.
my f# implementation of project euler #2
let rec calc sum prev1 prev2 evensum =
if sum > 4000000 then evensum
else
let newsum = prev1 + prev2
calc newsum prev2 newsum (if newsum % 2 = 0 then evensum + newsum else evensum)
printf "%d" (calc 0 0 1 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment