Speaking of Project Euler Problem 2 , you can consider instead of the recursion coming from Seq.unfold , which is very idiomatic and gives you all the Fibonacci numbers at once:
let fibs = Seq.unfold (fun (current, next) -> Some(current, (next, current + next))) (1,2)
Now fibs is a lazy sequence of Fibonacci numbers:
>fibs;; val it : seq<int> = seq[1; 2; 3; 5; ...]
And to do this, BigInteger simply substituting (1,2) for (1I,2I) , although this solution allows you to stay within ordinary integers.
Gene belitski
source share