Sometimes the difference between two distinct words of the same length cannot be smaller than a certain minimal amount. In particular if two distinct words of the same length are both periodic or quasiperiodic, then their Hamming distance is at least 2. We study here how the minimum Hamming distance dist(x, y) between two words x, y of the same length n depends on their periods. Similar problems were considered in [1] in the context of quasiperiodicities. We say that a period p of a word x is primitive if x does not have any smaller period p which divides p. For integers p, n (p ≤ n) we define Pp(n) as the set of words of length n with primitive period p. We show several results related to the following functions introduced in this paper for p = q and n ≥ max(p, q).Lemma 1 (Periodicity Lemma [14]). If a word x has periods p and q and |x| ≥ p + q − GCD(p, q), then x also has a period GCD(p, q).Other known extensions of this lemma include a variant with three [10] and an arbitrary number of specified periods [11,16,17,23], the so-called new periodicity lemma [13,3], a periodicity lemma for repetitions that involve morphisms [19], and extensions into periodicity of partial words [4