Using the ring Z/pZ, where p is a prime, we can construct a detection pattern of size p - 1.

Construction of detection patterns

Choose a primitive element x of Z/pZ. The detection pattern consists precisely of those pairs (i,j) of time i and frequency j satisfying xi-1 = j mod p.

This pattern is optimal.