18 lines
453 B
FSharp
18 lines
453 B
FSharp
module _47
|
|
|
|
let consequtivePrimes =
|
|
let max = 200000
|
|
let count = 4
|
|
let d = common.divisors max
|
|
let p = common.primeArray ((int)(max/2)) |> Set.ofArray
|
|
|
|
d
|
|
|> Seq.mapi (fun i ds ->
|
|
let ds = i::ds |> Set.ofList
|
|
let dp = Set.intersect ds p
|
|
(i, Set.count dp))
|
|
|> Seq.filter (snd >> (=) count)
|
|
|> Seq.map fst
|
|
|> Seq.windowed count
|
|
|> Seq.find (fun ns -> ns.[count - 1] - ns.[0] = count - 1)
|