Exact power-of-two periods of the doubling map (source code)

= Exact power-of-two periods of the doubling map

For $n=2^k$, every proper period dividing $n$ divides $n/2$. Hence the number of points of exact period $2^k$ is
$$
(2^{2^k}-1)-(2^{2^{k-1}}-1)
=2^{2^k}-2^{2^{k-1}}.
$$