Project Euler Problem #7
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
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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