23 lines
600 B
FSharp
23 lines
600 B
FSharp
module _46
|
|
|
|
let smallestOddCompositeNotSumOfPrimeTwiceSquare =
|
|
let ceiling = 10000
|
|
|
|
let composites =
|
|
common.compositeArray ceiling
|
|
|> Seq.filter (fun c -> c % 2 = 1)
|
|
|> Set.ofSeq
|
|
|
|
let twiceSquares =
|
|
Seq.unfold (fun state -> Some(2 * state * state, state + 1)) 1
|
|
|
|
let primes = common.primeArray ceiling
|
|
let twiceSquareList = twiceSquares |> Seq.take ceiling
|
|
|
|
let sumOfPrimceTwiceSquare =
|
|
common.crossMap (+) primes twiceSquareList
|
|
|> Seq.distinct
|
|
|> Set.ofSeq
|
|
|
|
Set.difference composites sumOfPrimceTwiceSquare
|