Skip to content

Instantly share code, notes, and snippets.

@monkeygroover
Created March 26, 2016 22:46
Show Gist options
  • Save monkeygroover/e6615a16727096e16992 to your computer and use it in GitHub Desktop.
Save monkeygroover/e6615a16727096e16992 to your computer and use it in GitHub Desktop.
euler20
let units bi = (bi % 10I, bi/10I)
let rec sum bi = match units(bi) with
| (u, r) when r = 0I -> u
| (u, r) -> u + sum(r)
let rec fac(n:int): bigint = match n with
| 1 -> bigint(1)
| n -> bigint(n) * fac(n - 1)
let result = sum(fac(100))
printfn "%A" result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment