Cardinality of associate classes in quotient ring of Gaussian integers. Let $n=up_1^{n_1}p_2^{n_2}\cdots p_k^{n_k}$, where $p_i$ is a prime and $u$ is a unit in $\mathbb{Z}[i]$ be the factorization of $n$ in $\mathbb{Z}[i]$.
Then for any proper divisor $d$ of $\mathbb{Z}[i]$, the element $d+\langle n \rangle$ is a zero-divisor of $\frac{\mathbb{Z}[i]}{\langle n \rangle}$
Consider the set, the associate class of $d+\langle n \rangle$ in $\frac{\mathbb{Z}[i]}{\langle n \rangle}$, = $\{ud+\langle n \rangle: u +\langle n \rangle\text{ is a unit in }\frac{\mathbb{Z}[i]}{\langle n \rangle}\}$.
My question is: I want to prove that,  $|\{ud+\langle n \rangle: u +\langle n \rangle\text{ is a unit in }\frac{\mathbb{Z}[i]}{\langle n \rangle}\}|$= Number of units in $\frac{\mathbb{Z}[i]}{\langle \frac{n}{d} \rangle}$
We can see that, the number of units in $\frac{\mathbb{Z}[i]}{\langle a+ib \rangle}$ is given by generalized Euler function and is equal to $
      \phi_{\mathbb{Z}[i]}(a+ib)=N(a+ib)\prod_{p|(a+ib)}(1-\frac{1}{N(p)})$, where $N(a+ib)=a^2+b^2$.
I verified the result for n values $n=4,5,6,8 $ etc.
But I can't see a method to prove it.
 A: Let $R$ be any unique factorization domain, and let $n = up_1^{e_1} \cdots p_s^{e_s}$ be any nonunit element of $R$, written as a product of distinct prime elements $p_i$ and a unit $u$, and  $d = u'p_1^{c_1} \cdots p_s^{c_s}$ a divisor of $n$.  Then $c_i \leq e_i$.
We have $R/(n) = \bigoplus\limits_{i=1}^s R/(p_i^{e_i})$, and $d = ( d+(p_1^{e_1}), ... , d + (p_s^{e_s})) = (u_1 p_1^{c_1} + (p_1^{e_1}), ... , u_sp_s^{c_s}+(p_s^{e_s}))$, where the $u_i$ are units in $R/(p_i^{e_i})$.
If we let $v = (v_1, ... , v_s)$ run through all the units of $R/(n)$ (so $v_i$ runs through all the units of $R/(p_i^{e_i})$), we want to see how many distinct elements $vd + (n)$ there are.  If we suppose that $v$ and $v' = (v_1', ... , v_s')$ are units in $R/(n)$, then we have
$$vd+(n) = v'd+(n)$$
if and only if $$v_iu_ip_i^{c_i} \equiv  v_i'p_i^{c_i} \pmod{p_i^{e_i}}$$ for each $1 \leq i \leq s$, if and only if
$$v_iu_i = v_i' \pmod{p_i^{e_i-c_i}}$$
for each $i$. Thus from the surjection of units $U(R/(p_i^{e_i})) \rightarrow  U(R/(p_i^{e_i-c_i}))$, we may choose $|U(R/(p_i^{e_i-c_i}))|$ distinct units $v_i$ of $R/(p_i^{e_i})$, and together the products
$$vd+(n) = (v_1d+(p_1^{e_1}), ... , v_sd+(p_s^{e_s}))$$
over all $v= (v_1, ... , v_s)$ will be distinct and exhuast the set $\{vd + (n) : v \textrm{ is a unit in } R/(n)\}$.  And as you say, the cardinality of this set is the cardinality of
$$\prod\limits_{i=1}^s U(R/(p_i^{e_i-c_i})) = U(R/(\frac{n}{d})).$$
