Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Thanks, this is exactly it! Is there some closed-form mathematical description of the order of $[k]$ in $U_n$? The second q is... Suppose I consider the elements of $\mathbb{Z}/n\mathbb{Z}$ in turn. And suppose I maintain a "visited" bit for each. $0$ is solo, $1$ leads through a cycle of $5$, the same with $2$. Now, as I consider $3, 4, 5, ...$ I'll see that I've flipped the "visited" bit for each element. This saves recomputing any cycle, but it comes at the cost of maintaining bits. Can I instead map each element to a canonical element of its cycle in such a way to avoid BOTH costs?