Project Euler Problem #5
Smallest number divisible by each of 1 to 20:
First cut (takes almost an hour to execute!):
let isFactor n d = n % d = 0
{1..Int32.MaxValue}
|> Seq.find (fun n -> [1..20] |> List.forall (isFactor n))
Second cut (takes a millisecond!):
let rec gcd a b = if b = 0 then a else gcd b (a % b)
[1..20] |> List.reduceBack (fun a b -> (a / (gcd a b)) * b)