Analytic function $f$ such that $(f(z))^n= f(z^n)$ Let $f(z) = \sum_{k\geq 0}a_kz^k$ be an analytic function, where $a_k\in\mathbb{C}$ for $k\geq 0$. I am trying to get some conditions for $a_k$ that give us the general form of $f$ such that $(f(z))^n= f(z^n)$.
What I tried is to use the Multinomial Theorem, but I get stuck while trying to compute the coefficients of $(f(z))^n$.
I would like to obtain the general solution, but in fact I need only two cases: if either $a_0 = f(0) = 0$ or $a_1 = f'(0) = 0$.
Thank you!
 A: If $n \le 2$ the characterization is immediate, so assume otherwise.
Lemma. If $f(0) \ne 0$, then $f(z) \equiv \zeta$ where $\zeta$ is an $(n-1)$-th root of unity.
Proof. Iterate the equality, finding that for any $k \in \mathbb{N}$ we have
$$f(\lambda^{n^k}) = f(\lambda)^{n^k}$$
Applying this to $\lambda \in \mathbb{D}$ and letting $k \to \infty$, we find that $f(\lambda)^{n^k} \to f(0) \ne 0$ by assumption. Certainly this implies that $|f(\lambda)| = 1$, and thus $f$ is some unimodular constant. Applying the equation with $z = 1$ then shows that constant is an $(n-1)$-th root of unity.

So we can now consider the case that $f(0) = 0$. Let $m$ be the order of $0$ as a zero of $f$ (if defined) and look at
$$g(z) = \frac{f(z)}{z^m}$$
with the obvious definition at $z = 0$. This function $g$ satisfies the same functional equation that $f$ does and has non-zero value at $0$ (where we apply the identity theorem to $g(z^n) - g(z)^n$ to get equality at the origin). By the lemma, $f(z) = z^m \zeta$ for an $(n-1)$-th root of unity.
Thus, all solutions are of the form $f(z) = z^m \zeta$ with $\zeta^{n - 1} = 1$, and the zero function.
