As for x∈{0,1,…,2n−1} we have f(x)∈{0,1,…,2n−1}, and for x≥2n we have f(x)<x, we get f(x)≤max(x,2n−1). It follows that if x∈A, then
x=f[n](x)≤max(f[n−1](x),2n−1)≤⋯≤max(f(x),2n−1).
If x≥2n, then x≤f(x), a contradiction, thus A is contained in {0,1,…,2n−1}.
We shall prove the equality A={0,1,…,2n−1}. We give two proofs for the reverse inclusion.
i.
From f(2n−1)=2n−1 deduce 2n−1∈A. As 2f(x)∈{x,x+2n−1}, 2f(x) is congruent to x modulo 2n−1. Inductively, x≡2nf[n](x)≡f(x)(mod2n−1). Because f(x)<2n−1 for x<2n−1, we obtain f[n](x)=x if x∈{0,1,…,2n−2}.
ii.
Use base 2 to represent any number in x∈{0,1,…,2n−1} using n digits, putting zero at the beginning, if necessary. To obtain f(x) from x one has to move the last digit of x on the first position. After n movements the digits of x are at the same places as at the beginning, that is f[n](x)=x.