Share via


Project Euler Problem #7

Find the 10001st prime

let naturals = Seq.unfold (fun i -> Some(i, i + 1))
let primes =
    naturals 2 |> Seq.filter (fun n ->
        seq { 2..int (sqrt (float n)) }
|> Seq.forall (fun x -> n % x <> 0))
Seq.nth 10000 primes