Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a965f40835
Fetching contributors…

Cannot retrieve contributors at this time

14 lines (8 sloc) 0.368 kb
(*
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
*)
let rec gcd i j = if j = 0L then i else gcd j (i%j)
let lcm i j = i * j / (gcd i j)
let smallest = {1L..20L} |> Seq.fold(lcm)(1L)
printfn "%i" smallest
Jump to Line
Something went wrong with that request. Please try again.