{-# OPTIONS_GHC -O2 -fno-cse #-} primesTMWE = 2:3:5:7: gapsW 11 wheel (joinT3 $ hitsW 11 wheel primes11) where gapsW k ws@(d:w) cs@(c:u) | k==c = gapsW (k+d) w u : hitsW (k+d) w u joinT3 ((x:xs): ~(ys:zs:t)) = x : union xs (union ys zs) `union` joinT3 (pairs t) pairs ((x:xs):ys:t) = (x : union xs ys) : pairs t wheel = 2:4:2:4:6:2:6:4:2:4:6:6:2:6:4:2:6:4:6:8:4:2:4:2: 4:8:6:4:6:2:4:6:2:6:6:4:2:4:6:2:6:4:2:4:2:10:2:10:wheel main = do LT -> x : union xs (y:ys) EQ -> x : union xs ys GT -> y : union (x:xs) ys
4000000
[67867831,67867843,67867901,67867903,67867907,67867937,67867949,67867951,67867957,67867967] [67867979,67867999,67868011,67868023,67868041,67868069,67868077,67868111,67868123,67868153]