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
 A: 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}.$$
A: 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.
