Let $n \in \mathbb{N}$ and $\zeta_n = e^{2i\pi/n} $ we define the following subring of $\mathbb{C}$ by,
$$\mathbb{Z}[\zeta_n] = \{ P(\zeta_n) : P \in \mathbb{Z}[x]\}$$
One can easily show that,
$$\mathbb{Z}[\zeta_n] = \{a_0+a_1 \zeta_n+\dots+a_{n-1} \zeta_n^{n-1} : a_i \in \mathbb{Z} \}$$
My question is about the number $N_n$ of ring endomorphisms of $\mathbb{Z}[\zeta_n]$.
My work so far :
If $f : \mathbb{Z}[\zeta_n] \rightarrow \mathbb{Z}[\zeta_n]$ is a ring morphism then as $\mathbb{Z}[\zeta_n]$ is a subring of $\mathbb{C}$ we have, $f(m) = m$ for all $m \in \mathbb{Z}$. From that we easily deduce that for any element of $\mathbb{Z}[\zeta_n]$ we must have,
$$f\left(\sum_{i=0}^{n-1} a_i(\zeta_n)^i \right)=\sum_{i=0}^{n-1} a_if(\zeta_n)^i$$
And more generally,
$$\forall P \in \mathbb{Z}[x],f(P(\zeta_n))= P(f(\zeta_n)) $$
Moreover, as we know that $f(1) = 1$ and $\zeta_n^n = 1$ then $f(\zeta_n)^n=f(\zeta_n^n) = f(1) = 1$. Hence, $f(\zeta_n)$ is a $n$th root of unity, so there exists $0\leq k \leq n-1$ such that $f(\zeta_n) = \zeta_n^k$.
Therefore $N_n \leq n$. If we only considered the number of group morphisms then the answer would be $n$, but here having a ring morphism is far more restrictive, and we can see on simple examples that it should not be the case.
Indeed, $\mathbb{Z}[\zeta_1] = \mathbb{Z}[\zeta_2] = \mathbb{Z}$, thus $N_1 =N_2 = 1$. Likewise, $\mathbb{Z}[\zeta_4] = \mathbb{Z}[i]$ where there are only two ring morphisms, so $N_4 = 2$.
From this observation, I deduced the following conjecture $$\forall n \in \mathbb{N}, N_n = \varphi(n) $$
where $\varphi$ denotes the Euler's totient function.
My hope would be to show that $f(\zeta_n) = \zeta_n^k$ has to be a generator of the cyclic group of the $n$th roots of unity, that is to say $k$ and $n$ are coprimes.
Equivalently, I want to prove that the map,
$$f : P(\zeta_n) \in \mathbb{Z}[\zeta_n] \mapsto P(\zeta_n^k) \in \mathbb{Z}[\zeta_n]$$
is only well-defined when $k \wedge n = 1$ (i.e. $f(P(\zeta_n))$ does not depend on the choice of $P$). From this point on, it will be easy to prove that $f$ is indeed a ring morphism.
If $P = a_0+a_1x+\dots+a_p x^p \in \mathbb{Z}[x]$ and $Q = b_0+b_1x+\dots+b_q x^q \in \mathbb{Z}[x]$ are such that $P(\zeta) = Q(\zeta)$ where $\zeta$ is any generator of the $n$th roots of unity, then we have,
$$\sum_{j=0}^{n-1} \left( \sum_{i \equiv j [n]} a_i \right)\zeta^j = \sum_{j=0}^{n-1} \left(\sum_{i \equiv j [n]} b_i \right) \zeta^j$$
But somehow I have difficulties going further, does this equality for one generator implies that all coefficients involved must be equal? Is $(1,\zeta,\dots,\zeta^{n-1})$ some sort of basis? What happens when $k$ and $n$ are not coprimes, are there any simple counter examples?
I possibly could have missed simpler arguments. What are you thoughts on this problem and on my reasoning? Any hint or suggestion will be welcomed.
Edit - current status : Thanks to Rob Arthan's answer, we deduce that $k$ being coprime with $n$ is a necessary condition for $f$ to be a ring homomorphism which leads me to,
$$N_n \leq \varphi(n) $$
I want to show that this number is reached by defining $\varphi(n)$ different ring homomorphisms.
Some observations:
As $\zeta_n^k$ is a primitive $n$th root of unity then $\Bbb{Z}[\zeta_n] = \Bbb{Z}[\zeta_n^k]$.
I realised that if,
$$\sum_{j=0}^{n-1} a_j \zeta_n^j = 0 $$
$\qquad$ then all $a_j$ are not necessarily zero, but this was to be expected.
As Z Wu pointed out, the cyclotomic polynomials come in handy for this problem that involves primitive roots of unity. I really like this approach, but I am not supposed to know anything about cyclotomic polynomials in my algebra course, so it led me to wonder that there must maybe exist a more elementary approach.