Yes, this is a special case of a theorem of Borel. Given any sequence $(a_n)$ there is a smooth function on $\Bbb R$ whose Maclaurin series
is $\sum a_nx^n$.
I outline the proof. There is a smooth function $f:\Bbb R\to\Bbb R$
which equals $1$ on $[-1,1]$ and vanishes outside $[-2,2]$. Then consider
$f(x)=\sum_{n=0}^\infty a_n x^n\phi(x/\varepsilon_n)$, where $\varepsilon_n$ is a sequence of positive numbers tending to zero.
Then if $\varepsilon_n$ tends to zero rapidly enough,
the series for $f$, and its formal derivatives of all orders will
converge uniformly, and it will follow that $f$ has the given
Maclaurin series.
For a more general result, see Theorem 1.2.6 in Volume 1 of
Hormander's The Analysis of Linear Partial Differential Operators.