TITLE: Generalized Euler phi function
QUESTION [18 upvotes]: 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.

REPLY [2 votes]: 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.