Let $p_1,p_2, \dots , p_r$ be different odd prime numbers, and $n$ be the multiplication of them $n = p_1 p_2 \dots p_r$. Let
$$a \in \mathbb{Z} / n \mathbb{Z}$$
and assume that $\gcd(a,n)$ is divided by $t$ different prime numbers ($0 \le t \le r$).
I am trying to show that the number of solution to $x^2 \equiv a \pmod{n}$ is zero or $2^{r-t}$.
How would I go about doing this?
there is another way to solve it?
If $p_1$ divides $a$ and $n$ then $a=p_1a_1$ and $n=p_1n_1$. If $x^2\equiv a\ (mod\ n)$ then $x=p_1x_1$. Therefore $x^2=p_1^2x_1^2\equiv p_1a_1\ (mod\ p_1n_1)$. We can divide the whole equation by $p_1$ to get
$$p_1x_1^2\equiv a_1\ (mod\ n_1)$$
Since $gcd(p_1,n_1)=1$ there is $p_1^{-1}$ mod $n_1$. Therefore the original equation has the same number of solutions as $$x_1^2\equiv p_1^{-1}a_1\ (mod\ n_1)$$
We can continue in this way with all primes that divide both $n$ and $a$. This means that we can reduce to the case that $gcd(a,n)=1$.
For this case we need to solve each congruence $x^2\equiv a\ (mod\ p_i)$, for the primes that are not common for $a$ and $n$. Each have two solutions (or zero). For each set of solutions of these equations we have a solution for the original one (Chinese remainder theorem). Therefore we get $2^{k}$ solutions, where $k$ is the number of different primes that are not common to $a$ and $n$, i.e. $k=r-t$.