RosettaCodeData/Task/McNuggets-problem/F-Sharp/mcnuggets-problem.fs
2023-07-01 13:44:08 -04:00

3 lines
263 B
FSharp

// McNuggets. Nigel Galloway: October 28th., 2018
let fN n g = Seq.initInfinite(fun ng->ng*n+g)|>Seq.takeWhile(fun n->n<=100)
printfn "%d" (Set.maxElement(Set.difference (set[1..100]) (fN 20 0|>Seq.collect(fun n->fN 9 n)|>Seq.collect(fun n->fN 6 n)|>Set.ofSeq)))