We prove the following stronger statement: For any k≥0 and a≥1, the values f(a),f(a+1),…,f(a+3k−1) are all distinct modulo 3k; that is, these numbers form a complete set of residues modulo 3k. We will induct on k, the case k=0 being trivial.
Assume the statement true for a given k; we will prove it for k+1. For any a≥1, we have
f(a+3k)−f(a)=[f(a+1)−f(a)]+[f(a+2)−f(a+1)]+⋯+[f(a+3k)−f(a+3k−1)]=2f(a)+2f(a+1)+⋯+2f(a+3k−1).
Note that by Euler's theorem, to know 2x modulo 3k+1 (x≥1), it suffices to know x modulo φ(3k+1)=2⋅3k. Now f(x) is always odd (this follows from the definition), while the inductive hypothesis tells us that f(a),…,f(a+3k−1) are distinct mod 3k. Hence sets
{f(a),…,f(a+3k−1)}and{1,3,5,…,2⋅3k−1}
are congruent to each other modulo 2⋅3k. Therefore, modulo 3k+1, we have
f(a+3k)−f(a)≡21+23+25+⋯+22⋅3k−1≡2(1+4+42+⋯+43k−1)≡32(43k−1).
By the binomial theorem, we have
43k−1=(1+3)3k−1=3⋅(13k)+…,
where each of the remaining summands are divisible by 3k+2; hence
f(a+3k)−f(a)≡2⋅3k(mod3k)(20)
for all a.
Returning to the sequence
f(a),f(a+1),…,f(a+3k+1−1),
we see that, since f(b)≡f(b+3k) modulo 3k (a consequence of the inductive hypothesis), the terms congruent to one another modulo 3k come in triples (f(b),f(b+3k),f(b+2⋅3k)). By (20), these terms, modulo 3k+1, are congruent to (f(b),f(b)+2⋅3k,f(b)+3k), which are pairwise distinct, completing our induction.