# Number of unique congruence classes with a specific property

Let $n=p_1^{k_1}\ldots p_r^{k_r}, k_i\in\mathbb{N}$ and $p_i$ are all distinct primes. How many unique congruence classes $\overline{x}$ are there in the ring $\mathbb{Z}_n$ such that $\overline{x}^2=\overline{0}$?
Looking for $0<x<n$ such that $x^2\equiv 0\pmod{n}$, i.e $p_1^{k_1}\ldots p_r^{k_r}\mid x^2$. How should I determine the number, though? Advice?

Thoughts so far: if we let $t=x^2$, considering $Z_n\cong Z_{p_1^{k_1}}\times\ldots\times Z_{p_r^{k_r}}$, we are to consider $$\begin{cases}t_1\equiv 0\pmod{p_1^{k_1}}\\ t_2\equiv 0\pmod{p_2^{k_2}}\\ \ldots \\ t_r\equiv 0\pmod{p_r^{k_r}} \end{cases}$$ where $t\mapsto (t_1,\ldots ,t_r)$ such that $t\equiv t_i\pmod{p_i^{k_i}}$. Since the moduli are pairwise without common divisor (are they, though?), the Chinese remainder thm tells us there exists exactly one solution.

confused

You want $$x = p_1^{e_1}\ldots p_r^{e_r} z,$$ where for each $i$ you have

• $\gcd(z, p_{i}) = 1$,
• $2 e_{i} \ge k_{i}$.

So these $x$ are exactly the multiples of $$X = p_1^{f_1}\ldots p_r^{f_r},$$ where $$f_{i} = \lceil k_{i} \rceil = \begin{cases} \dfrac{k_{i}}{2} & \text{if k_{i} is even}\\ \dfrac{k_{i}+1}{2} & \text{if k_{i} is odd}\\\end{cases}.$$

There are $$\frac{n}{X} = p_1^{g_1}\ldots p_r^{g_r}$$ such multiples between $0$ (excluded) and $n$ (included), where $$g_{i} = \lfloor k_{i} \rfloor = \begin{cases} \dfrac{k_{i}}{2} & \text{if k_{i} is even}\\ \dfrac{k_{i}-1}{2} & \text{if k_{i} is odd}\\\end{cases}.$$

• that is so well done. – Alvin Lepik Mar 7 '16 at 14:10

If $n$ is a prime, the answer is $0$ (since $\mathbb{Z}_n$ is a field and it contains no zero divisors).

If $n$ is a composite, the number of nilpotent elements of $\mathbb{Z}_n$ is $$p_1^{k_1-1}\dotsm p_r^{k_r-1}=\frac n{p_1\dotsm p_r}$$ (see: To find the nilpotent elements of $\Bbb Z_n$ and also the number of nilpotent elements of $\Bbb Z_n$. ) and it is among those elements, where the required $x$'s should be searched.

• That provides the total number of nilpotent classes, however, how should I narrow it down to the "height" 2? Keeping in mind the isomorphism pointed out, it must be then true that $$\forall i\in\{1,\ldots, r\}\left (\overline{m}^2_i\equiv 0\pmod{p_i^{k_i}}\Longleftrightarrow p_i^{k_i}\mid m_i^2\right )$$ – Alvin Lepik Mar 7 '16 at 7:30
• This problem smells strongly of the Chinese Remainder Theorem. I'll cook something up. – Alvin Lepik Mar 7 '16 at 7:43