Calculate $f^{(n)}(0)$ where $f(x) = e^{x^2}$ The problem is stated as:

Calculate $f^{(n)}(0)$ where $f(x) = e^{x^2}$ and $n \in \mathbb{N}$

Attempt:
We know that $e^{x} = \sum_{k=0}^{n} \frac{1}{k!}x^k +\frac{x^{n+1}e^{\theta x}}{(n+1)!}$ for some $\theta = \theta (x) \in (0,1)$
Hence, $e^{x^2}=\sum_{k=0}^{n} \frac{1}{k!}x^{2k} +\frac{x^{2n+1}e^{\theta x^2}}{(n+1)!}$
Comparing terms with the general Maclaurin polynomial, we get that:
$\frac{1}{k!}x^{2k} = \frac{f^{(n)}(0)}{n!}x^{n}$
First, we have to equate the exponent of the $x$ - terms, so $2k = n \iff k = n/2$
Therefore, we have that:
$\Rightarrow f^{n}(0) = \frac{n!}{(n/2)!}$
However, since we had natural numbers in our expression, I wonder what would happen if $n$ was odd in this case. How could I generalize this even further?
Thanks!
 A: If $n$ is odd, then since $f^{(n)}$ is an odd function, $f^{(n)}(0)=0$.
A: You can make the problem more general and compute the $n^{th}$ derivative at any value of $n$.
They all write
$$f^{(n)}(x)=e^{x^2} P_n(x)$$ Computing the first ones (using the chain rule makes it easy)
$$f^{(n+1)}(x)=e^{x^2}\left(2x P_n(x)+P'_n(x) \right)$$
So, you have
$$\left(
\begin{array}{cc}
n & P_n(x) \\
 1 & 2 x \\
 2 & 4 x^2+2 \\
 3 & 8 x^3+12 x \\
 4 & 16 x^4+48 x^2+12 \\
 5 & 32 x^5+160 x^3+120 x \\
 6 & 64 x^6+480 x^4+720 x^2+120 \\
 7 & 128 x^7+1344 x^5+3360 x^3+1680 x \\
 8 & 256 x^8+3584 x^6+13440 x^4+13440 x^2+1680 \\
 9 & 512 x^9+9216 x^7+48384 x^5+80640 x^3+30240 x \\
 10 & 1024 x^{10}+23040 x^8+161280 x^6+403200 x^4+302400 x^2+30240
\end{array}
\right)$$ where you can notice interesting patterns.
In fact
$$\color{red}{P_n=i^{-n} H_n(i x)\implies f^{(n)}(x)=i^{-n} H_n(i x)e^{x^2}}$$
Now, if you make $x=0$, as expected since $e^{x^2}$ is a even function, $f^{(2n+1)}(0)=0$ and for $f^{(2n)}(0)$ generates the  sequence
$$\{2,12,120,1680,30240,665280,\cdots\}$$ which is your result.
A: Comparing terms exactly the same way you did for the even order terms, the odd order derivatives are zero at the origin, as the coefficients of the odd degree terms of the Maclaurin series are all zero.
A: We have
\begin{align*}
e^{x^2}&=\sum_{k=0}^\infty \frac{(x^2)^k}{k!}\\
&=\frac{x^0}{0!}+\frac{x^2}{1!}+\frac{x^4}{2!}+\frac{x^6}{3!}+\dots\\
&=\frac{x^0}{0!}+0\frac{x^1}{1!}+2!\frac{x^2}{2!}+0\frac{x^3}{3!}+\frac{4!}{2!}\frac{x^4}{4!}+0\frac{x^5}{5!}+\frac{6!}{3!}\frac{x^6}{6!}+\dots\\
\end{align*}
So,
$$e^{x^2}=\sum_{k=0}^\infty a_k\frac{x^k}{k!},$$
where
\begin{align*}
a_k=\begin{cases}
\frac{k!}{(k/2)!}&\text{if $k$ is even}\\
0&\text{if $k$ is odd}
\end{cases}
\end{align*}
