Let $x, y$ be two elements of a commutative ring $R$. Then we say $x$ and $y$ are associate, denoted $x ∼ y$, if and only if $x = uy$ for a unit $u$ in $R$. Then the equivalence class, $[x] = \{z \in R| z ∼ x\}$ is the associate class of $x$.
My question is: How many different associated classes exist in the ring of Gaussian integers modulo $n$?, $\mathbb{Z}_n[i]$. I expect an answer in terms of $n$ or using the prime factorization of $n$ in $\mathbb{Z}[i]$ or in $\mathbb{Z}$.
I have seen the post about $\mathbb{Z}_n$. But, here unlike in $\mathbb{Z}_n$, the number of associated classes is not equal to the number of principal ideals. $\mathbb{Z}_4[i]$ is an example for this, which has 9 principal ideals but has only 5 associate classes.
Working out with examples for $n$ up to 12, I have noticed that, If $n=2^ap_1^{k_1}p_2^{k_2}\cdots p_t^{k_t}q_1^{m_1}q_2^{m_2} \cdots q_s^{m_s}$ be the prime factorization of $n$ in $\mathbb{Z}$ such that $p_i\equiv 1 \mod 4$ and $q_i \equiv 3 \mod 4$. Then the number of conjugate classes is equal to $(2a+1)(K_1+1)^2(k_2+1)^2 \cdots (k_t+1)^2(m_1+1)(m_2+1)\cdots (m_s+1)$. But I didn't found a way to prove this.
It is also true here that the number of distinct associated classes of $\Bbb Z_n[i]$ is the number of principal ideals. You can run over the exact same argument, as the one in your linked post, to show that the map $$\chi:\left(\frac{\Bbb Z[i]}{(n)}\right)^\times\twoheadrightarrow \left(\frac{\Bbb Z[i]}{(\alpha)}\right)^\times$$ is surjective for any divisor $\alpha\in\Bbb Z[i]$ of $n$. To show this, let $\delta\in\left(\frac{\Bbb Z[i]}{(\alpha)}\right)^\times$, we want to construct a $\gamma\in\left(\frac{\Bbb Z[i]}{(n)}\right)^\times$ such that $\chi(\gamma)=\delta$. Write $n=n'\alpha'$, where $\gcd(n',\alpha')=1$ and let $\alpha'$ consist of the same primes as $\alpha$, therefore $\alpha\mid\alpha'$. Then by Bezout's identity (which holds in any PID) there are $x,y\in\Bbb Z[i]$ such that $$n'x+\alpha'y=1$$ Now let $\gamma=\delta n'x+\alpha' y$, then $\gcd(\gamma,n)=1$, so that $\gamma\in \left(\frac{\Bbb Z[i]}{(n)}\right)^\times$. Also $\chi(\gamma)=\delta$.
Looking at the factorization $n=2^ap_1^{k_1}p_2^{k_2}\cdots p_t^{k_t}q_1^{m_1}q_2^{m_2} \cdots q_s^{m_s}$ notice that:
It is therefore easier to see your result if we rewrite the factorization of $n$ as $$n=(1-i)^{2a}(\pi^{k_1}_1\bar{\pi}^{k_1}_1)(\pi^{k_2}_2\bar{\pi}^{k_2}_2)\cdots (\pi^{k_t}_t\bar{\pi}^{k_t}_t)q_1^{m_1}q_2^{m_2} \cdots q_s^{m_s}$$
This means that:
$p^{k_i}_i$ gives ideals $(\pi^{x}_i\bar\pi^{y}_i)$ where $0\leq x,y\leq k_i$ so there are $(k_i+1)^2$ different ideals, because $p^{k_i}_i=\pi^{k_i}_i\bar\pi^{k_i}_i$ has $(k_i+1)^2$ divisors.
$q^{m_i}_i$ is prime, so it has $m_i+1$ different divisors.
$2^a=(i(1-i)^2)=i^a(1-i)^{2a}$. Here $(1-i)$ is irreducible so the number of divisors is $2a+1$.
The ring $\Bbb Z_4[i]$ has both 5 distinct principal ideals, and 5 distinct associated classes, which agrees with your formula.
$$\Bbb Z_4[i]=\{0,1,-1,i,-i,2,2i,1+i,1-i,i-1,-1-i,2i+1,2+i,2-i,2i-1\}$$
Notice first that the units in $\Bbb Z_4 [i]$ are $\{-1,1,-i,i,2i+1,2i-1,2+i,2-i\}$. Since $4=-(1-i)^4$ the ideals are $(1-i)^k$ for $k=0,1,2,3,4$, which gives: