exactly_chinese n xs = 
  let good m = 
        let r = foldb plusmod $ map (unit m) xs
        in  r === encode_mod m n
  in  all good $ take (mods $ length xs) primes

unit :: forall a. Boolean a => Int -> a -> [a]
unit m x = not x : x : replicate (m-2) false