An integer-valued function f (x) on the integers that is periodic of period p(e), p prime, can be matched, modulo p(m), by a polynomial function w(x); we show that w(x) may be taken to have degree at most (m (p - 1) + 1) p(e-1) - 1. Applications include a short proof of the theorem of McEliece on the divisibility of weights of codewords in p-ary cyclic codes by powers of p, an elementary proof of the Ax-Katz theorem on solutions of congruences modulo p, and results on the numbers of codewords in p-ary linear codes with weights in a given congruence class modulo p(e). (c) 2006 Elsevier B.V. All rights reserved.