Definition: An element $\displaystyle a$ in a ring is called an idempotent if $\displaystyle a^2=a.$
Question: Given an integer $\displaystyle n \geq 2,$ how many idempotents are there in $\displaystyle \mathbb{Z}/n\mathbb{Z}$ ?
Definition: An element $\displaystyle a$ in a ring is called an idempotent if $\displaystyle a^2=a.$
Question: Given an integer $\displaystyle n \geq 2,$ how many idempotents are there in $\displaystyle \mathbb{Z}/n\mathbb{Z}$ ?
Okay, this is actually very simple. I can’t believe I’ve taken such a long time to twig it.
It is clear that $\displaystyle a$ is an idempotent of $\displaystyle \mathbb Z/n\mathbb Z$ if and only if $\displaystyle n$ divides $\displaystyle a^2-a=a(a-1).$ Let $\displaystyle n=p_1^{k_1}p_2^{k_2}\cdots p_r^{k_r}$ where $\displaystyle p_1,p_2,\ldots,p_r$ are the distinct prime factors of $\displaystyle n.$ If $\displaystyle a$ is an idempotent then each prime $\displaystyle p_i$ must divide $\displaystyle a$ or $\displaystyle a-1,$ but not both – otherwise it would divide $\displaystyle a-(a-1)=1.$ So whichever factor it divides, the whole lot $\displaystyle p_i^{k_i}$ will divide that factor. And since each $\displaystyle p_i$ either divides $\displaystyle a$ or $\displaystyle a-1$ (2 choices), it emerges that the number of idempotents $\displaystyle a$ is precisely $\displaystyle 2^r.$
Hence the number of idempotents of $\displaystyle \mathbb Z/n\mathbb Z$ where $\displaystyle n\ge2$ is $\displaystyle 2^r$ where $\displaystyle r$ is the number of distinct prime factors of $\displaystyle n.$
This is one of the most wonderful problems I’ve ever tried – thank you ever so much, NonCommAlg. It’s a shame I can only thank you once – I would thank you more times if I could.