Generalized Euler phi function Let $n$ be an integer, there is a well-known formula for $\varphi(n)$ where $\varphi$ is the Euler phi function. Essentially, $\varphi(n)$ gives the number of invertible elements in $\mathbb{Z}/n\mathbb{Z}$. My questions are:
1) Since Dedekind domains have the same factorization theorem for ideals analogous to that of the integers, can one define a generalized Euler phi function type for an ideal of a Dedekind domain, i.e, $\varphi(I)$ shall give the number of invertible elements in $R/I$, and is there a nice formula for it? It makes sense to me that perhaps the formula should resemble that of the integer, using the factorization of $I$ into prime ideals. But I do not have a concrete idea of what it should be.
2) What about domains that are not Dedekind, more specifically, what are the minimum hypotheses that one can impose on a domain so that one can have perhaps a formula for Euler phi function type on the ideals? I am not sure if this even makes sense at this point.
 A: An old and two new references : Page 13 of W. Narkiewicz, Elementary and Analytic Theory of Algebraic Numbers, third edition, Springer Monogr. Math., Springer-Verlag, 2004.
C.Miguel, Menon’s identity in residually finite Dedekind domains, Journal of Number Theory 137 (2014) 179–185. DOI: 10.1016/j.jnt.2013.11.003
A. Kobin, A Primer on Zeta Functions and Decomposition Spaces, arXiv:2011.13903v1.
A: Yes, there is a formula for $\varphi(I)$ in the case of number fields. Let $R$ be the ring of integers of a number field. As mentioned in Greg's comment, it suffices to consider the case $I=\mathfrak{p}^n$ where $\mathfrak{p}$ is a maximal ideal of $R$. Then we have a surjective ring morphism
\begin{equation}
\frac{R}{\mathfrak{p}^n} \to \frac{R}{\mathfrak{p}}
\end{equation}
such that the preimage of $(R/\mathfrak{p})^{\times}$ is exactly $(R/\mathfrak{p}^n)^{\times}$ (this is because $R/\mathfrak{p}^n$ is local). Thus $\varphi(\mathfrak{p}^n) = q^{n-1}(q-1)$ where $q=\operatorname{Card} (R/\mathfrak{p})$.
Note that there are Dedekind domains $R$ such that $R/I$ is never finite for $I \neq R$ : for example take $R=\mathbf{C}[T]$.
To define a function $\varphi$ for general rings, one would obviously need the hypothesis that $(R/I)^{\times}$ is finite, but then it is only clear that $\varphi$ is (weakly) multiplicative in the sense that $\varphi(I\cdot J) = \varphi(I) \varphi(J)$ if $I+J=R$.
A: Let $R$ be a Dedekind domain and $\zeta_R$ it's zeta function. Using Mobius inversion on $|R/I|=\sum _{J|I}|(R/J)^*|$, and the fact that $\zeta_R(s)^{-1}=\sum \mu(I)/N(I)^s$ you get the identity
$$\frac{\zeta_R(s-1)}{\zeta_R(s)}=\sum \frac{\phi(I)}{N(I)^s}$$
Euler's formula for the generalized totient function follows from the Euler product and you get
$$\phi(I)=N(I)\prod_{P|I}(1-N(P)^{-1})$$
where the product ranges over all prime ideals dividing $I$.
If you're not in a Dedekind domain, the only part which doesn't generalize is the Euler product for the zeta function, or equivalently unique factorization into prime ideals, without which there is not much hope for a formula for this totient function.
