Skip to content

Instantly share code, notes, and snippets.

@cezarypiatek
Created October 23, 2016 18:38
Show Gist options
  • Save cezarypiatek/9f99d5f73b9948a2cba94249206435e5 to your computer and use it in GitHub Desktop.
Save cezarypiatek/9f99d5f73b9948a2cba94249206435e5 to your computer and use it in GitHub Desktop.
let bigFactorial n=
let rec loop x acc =
match x with
| x when x = 0I || x= 1I -> acc
| _ -> loop (x-1I) (acc*(x-1I))
loop n 1I
[<EntryPoint>]
let main argv =
let timer = System.Diagnostics.Stopwatch()
timer.Start()
let result = (bigFactorial 100000I)
timer.Stop()
printfn "%A in %dms" result timer.ElapsedMilliseconds
System.Console.ReadKey() |> ignore
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment