24 lines
515 B
FSharp
24 lines
515 B
FSharp
module _27
|
|
|
|
open System
|
|
|
|
let quadraticConsecutivePrimes =
|
|
let range = [-1000..1000]
|
|
|
|
let isPrime = common.isPrimeFunByMax 100000
|
|
|
|
let primeLength f =
|
|
common.allIntegers
|
|
|> Seq.map f
|
|
|> Seq.takeWhile isPrime
|
|
|> Seq.length
|
|
|
|
let abs = common.crossMap (fun a b -> (a,b)) range range
|
|
|
|
let quadradic (a,b) n =
|
|
n*n + a*n + b
|
|
|
|
abs
|
|
|> Seq.map (fun ab -> (ab, ab |> (quadradic >> primeLength)))
|
|
|> Seq.maxBy snd
|
|
|> (fun ((a,b),_)-> a * b) |