Mian-Chowla sequence: Difference between revisions

→‎{{header|Haskell}}: Point-free form of Spoon!'s excellent edit.
(→‎{{header|Haskell}}: Point-free form of Spoon!'s excellent edit.)
Line 661:
nextMC :: (Set Int, [Int], Int) -> (Set Int, [Int], Int)
nextMC (sumSet, mcs, n) =
let valid x = all (\mnot ->. notflip (member sumSet . (x + m) sumSet)) mcs
m = until valid succ n
in (foldr insert sumSet ((2 * m) : fmap (m +) mcs), m : mcs, m)
9,655

edits