Let $G$ be an open and connected set of the complex plane $\mathbb{C}$ and $f:G\rightarrow \mathbb{C}$ be analytic, such that for each $z\in G$ there is $n=n(z)\in \mathbb{N}$ such that $f^{(n)}(z)=0$. Prove that $f$ is a polynomial.
Attempt It seemed to me like a Baire-type application, since $\displaystyle G=\bigcup_{n=1}^{\infty}\{z\in G:~f^{(n)}(z)=0\}$, but there is no completeness on $G$ to work it that way.
Edit. Motivated by Entire function with vanishing derivatives?, let $n:G\rightarrow \mathbb{C}:~n(z)=\min\{k:~f^{(k)}(z)=0\}$ which is well defined and $\displaystyle G=\displaystyle \bigcup_{k=1}^{\infty}n^{-1}(\{k\}).$ Since $G$ is open, it is uncountable and at least one $n^{-1}(\{k\})$ is uncountable, so posseses an accumulation point $z_0 (\in G?)$. Therefore by the identity theorem $f^{(k)}$ is zero on $G$ and $f$ is a polynomial. My question is why $z_0\in G$?
Thanks a lot in advance for the help!