How to analyze $\sup_{x>0}|e^xf(x)| < \infty$ and $\sup_{n\in\mathbb{N}} |f^{(n)}(0)|< \infty$? 
Suppose that
  $$f(x)=1+\sum_{n=1}^\infty a_n \frac{x^n}{n!}\ \ \forall \ x\in \mathbb{R}$$
  where $\sup_{x>0}\left|e^xf(x)\right| < \infty$ and $\sup_{n\in\mathbb{N}} |a_n|< \infty$.
Prove that $a_n = (-1)^n$ , $\forall n\in \mathbb{N}$

It seems amazing to me. What we need to prove is $f(x)=e^{-x}$. It seems insufficient to prove this strong conclusion, but actually it is true and all the "counterexamples" I found were wrong.
My attempt
Put $g(x)=e^x f(x)$.
$$\left|g^{(n)}(0)\right|=\left|\sum_{k=0}^n \binom{n}{k} f^{(k)}(0)\right|\le 2^n\sup_{n\in\mathbb{N}} |a_n|  $$
Put $h(x)=g(\frac{x}{2})$. Thus 
$$h^{(n)}(0)=\frac{1}{2^n}g(0) \le \sup_{n\in\mathbb{N}} |a_n|$$
which implies that
$$h(x)=1+\sum_{n=1}^\infty b_n \frac{x^n}{n!}\ \ \forall \ x\in \mathbb{R}$$
where $$|b_n|\le \sup_{n\in\mathbb{N}} |a_n| \ \ \forall \ n\in\mathbb{N} 
\,\,\,\,\,\& \,\,\,\,\,  \sup_{x>0}\left|h(x)\right| < \infty $$ 
And hence if $b_k<0$, then there exists $l>k$ such that $b_l>0$. I want to yield a contradiction by supposing this, but I failed.
Any hints or other new ideas? Thanks in advance! 
(I heard that this problem can be solved by complex analysis. This is the reason why I attach the complex-analysis tag.)
 A: Let us prove the following: 

Theorem
  Let $(a_0, a_1, \dots)$ be a bounded sequence in $\mathbb C$, and suppose that for the power series
  \begin{equation*} 
f(z) := \sum_{n=0}^\infty a_n\frac{z^n}{n!}
\end{equation*}
  one has $f(x)=O(e^{-x})$ as $\mathbb R\ni x\to\infty$. 
  Then $a_n = C (-1)^n$ for some $C\in\mathbb C$ and all $n=0,1,\dots$.   

Proof.
Consider the sets 
\begin{equation*}
 S_1:=\{z\in\mathbb C\colon\Re z>-1\} \quad\text{and}\quad S_2:=\{z\in\mathbb C\colon|z|>1\}. 
\end{equation*}
Define functions $g_1\colon S_1\to\mathbb C$ and $g_2\colon S_2\to\mathbb C$ by the formulas 
\begin{equation*}
 g_1(z):=(z+1)\int_0^\infty e^{-zt}f(t)dt
\end{equation*}
for $z\in S_1$ and 
\begin{equation*}
 g_2(z):=(z+1)\sum_{n=0}^\infty a_n/z^{n+1}  
\end{equation*}
for $z\in S_2$. These functions are well defined and analytic, since $f(x)=O(e^{-x})$ as $\mathbb R\ni x\to\infty$ and the $a_n$'s are bounded. Moreover, because $\int_0^\infty e^{-zx}x^ndx=n!/z^{n+1}$ for all $z\in S_0:=\{w\in\mathbb C\colon\Re w>1\}\subset S_1\cap S_2$, one has $g_1=g_2$ on $S_0$. 
So, $g_1$ and $g_2$ are the restrictions to $S_1$ and $S_2$ of an analytic function $g\colon S\to\mathbb C$, where $S:=S_1\cup S_2=\mathbb C\setminus\{-1\}$. 
Moreover, $g(u)=g_1(u)=(u+1)\int_0^\infty e^{-ut}f(t)dt=O((u+1)\int_0^\infty e^{-ut-t}dt)=O(1)$ for real $u>-1$ and $|g(z)|=|g_2(z)|=O(|z|\sum_{n=0}^\infty 1/|z|^{n+1})=O(1)$ as $|z|\to\infty$. 
We shall show that $-1$ is a pole of $g$. 
Hence, by considering (say) the Laurent series for the function $g$ at the point $-1$ and recalling that $g(u)=O(1)$ for real $u>-1$, we conclude that $g$ is a complex constant, say $C$. Thus, 
\begin{equation*}
 \sum_{n=0}^\infty a_n/z^{n+1}=\frac{g_2(z)}{z+1}=\frac C{z+1}=C\frac1{z(1+1/z)}
 =\sum_{n=0}^\infty C(-1)^n/z^{n+1}
\end{equation*}
for $z\in S_2$, and so, indeed $a_n = C (-1)^n$ for all $n=0,1,\dots$.  
It remains to prove 

Lemma
  Let $K:=
\sup\limits_n|a_n|\vee\sup\limits_{t\ge0}|f(t)|e^t<\infty$. Take any $z\in\mathbb C$ such that $0<|z+1|<1/2$. 
  Then 
  \begin{equation*}
 |g(z)|\le6K/|z+1|^2. 
\end{equation*}
  So, $-1$ is a pole of $g$. 

Proof. 
Let $z$ be as in the statement of the lemma. Then $1/2\le|z|\le2$ and $x\le-1/2<0$, where
$x:=\Re z$ and $y:=\Im z$. 
Consider the following three possible cases. 
Case 1: $x=\Re z\le-1$. Then $z\in S_2$, whence 
\begin{equation*}
 |g(z)|=|g_2(z)|\le \frac12\,K\sum_{n=0}^\infty 1/|z|^{n+1}\le\frac K{|z|-1}. 
\end{equation*}
Moreover, here 
\begin{equation*}
|z+1|^2=(|x|-1)^2+y^2\le|x|-1+y^2
\le (|x|-1)(|x|+1)+y^2=|z|^2-1\le3(|z|-1). 
\end{equation*}
So, in Case 1 
\begin{equation*}
 |g(z)|\le\frac{3K}{|z+1|^2}. 
\end{equation*}
Case 2: $|z|\le1$. Then $z\in S_1$, whence 
\begin{equation*}
 |g(z)|=|g_1(z)|\le \frac12\,K\int_0^\infty e^{-xt-t}dt\le\frac K{1+x}. 
\end{equation*}
Moreover, here $y^2\le1-x^2\le2(1+x)$, whence 
\begin{equation*}
|z+1|^2=(1+x)^2+y^2\le(1+x)^2+2(1+x)\le4(1+x). 
\end{equation*}
So, in Case 2 
\begin{equation*}
 |g(z)|\le\frac{4K}{|z+1|^2}. 
\end{equation*}
Case 3: $x=\Re z>-1$ and $|z|>1$. Then $z\in S_1\cap S_2$. 
Moreover, here
\begin{multline*}
|z+1|^2=(1+x)^2+y^2=2(1+x)+x^2+y^2-1=2(1+x)+|z|^2-1 \\ 
\le
2(1+x)+3(|z|-1)
\le[4(1+x)]\vee[6(|z|-1)]. 
\end{multline*}
So, either (i) $|z+1|^2\le6(|z|-1)$ and then we bound $|g(z)|$ as in Case 1, getting here $|g(z)|\le\frac{6K}{|z+1|^2}$ or (ii) $|z+1|^2\le4(1+x)$ and then we bound $|g(z)|$ as in Case 2, getting here $|g(z)|\le\frac{4K}{|z+1|^2}$. 
Thus, the proof of the lemma is complete. 
Thus, the proof of the theorem is complete. 
Remark.
As the example of 
\begin{equation*}
f(x)=\exp\{-(a+i\sqrt{1-a^2})x\}\quad\text{or}\quad f(x)= 
\Re\exp\{-(a+i\sqrt{1-a^2})x\}  
\end{equation*}
for $a\in(0,1)$ shows, the condition $f(x)=O(e^{-x})$ in Theorem 1 cannot be relaxed to $f(x)=O(e^{-ax})$, for any real $a<1$.
A: There is a proof using the following Phragmén-Lindelöf principle on a sector of the complex plane.
Theorem: Consider a closed sector $S=\{z\in {\mathbb C}^*\mid \alpha\leq\arg(z)\leq\beta\}\cup\{0\}$ of angular opening $\beta-\alpha<\pi$.
Consider $f:S\to\mathbb C$ continuous on $S$, holomorphic in its interior.
Suppose that $f$ is bounded by 1 on the boundary of $S$ and that there exists a constant $C$ such that $|f(z)|\leq C\exp(C|z|)$ for $z\in S$.
Then $|f(z)|\leq1$ for $z\in S$.
To show that this theorem is not a mysterious black box, I add a (classical) proof using the maximum modulus principle at the end of the answer. Actually, this proof could be incorporated in the answer to make it only use the maximum modulus principle, but I prefer to refer to the Phragmén-Lindelöf principle.
Answer to the question: Let $M>1$ denote a bound for $|a_n|$, $n\in\mathbb N$ and for $|e^xf(x)|$, $x\geq0$. Then it is readily shown that
$$|f(x)|\leq M e^{|x|}\mbox{ for }x\in\mathbb C.$$
Consider now the sector $S=S(\alpha)$ of the upper half plane bounded by the rays 
$\arg x=0$ and $\arg x=\pi-\alpha$ with some small positive $\alpha$. Consider
on $S$ the function
$$g(x)=\frac1M\exp(q(\alpha)ix)\, e^xf(x)$$
with a real positive $q(\alpha)$ to be determined. Clearly its modulus can be bounded by some expression  $\exp(C|x|)$ on $S$ if $C$ is sufficiently large. On the ray $\arg x=0$, we find that $|g(x)|\leq 1$ by the choice of $M$. On the ray
$\arg x=\alpha$, we find
$$|g(x)|\leq e^{|x|}\exp\left(\mbox{Re}\,x\right)\exp\left(-q(\alpha)\mbox{Im}\,x\right)\leq\exp(|x|(1-\cos\alpha-q(\alpha)\sin\alpha)).$$
If we choose $q(\alpha)=(1-\cos(\alpha))/\sin(\alpha)$, then we can conclude that
$|g(x)|\leq1$ also on the ray $\arg x=\pi-\alpha$.
Now the Phragmén-Lindelöf principle applies on $S$ and yields that $|g(x)|\leq1$
on $S$. This means that
$$|e^xf(x)|\leq M\exp(q(\alpha)\mbox{Im}\,x)\mbox{ for }x\in S(\alpha).$$
Let us now fix some $x$ in the upper half plane ($\mbox{Im}\,x>0$). For any sufficiently small positive $\alpha$, the sector $S(\alpha)$ contains $x$ and the above inequality holds. Observe that $M$ is independent of $\alpha$.
Now as $\alpha$ tends to 0, $q(\alpha)=(1-\cos\alpha)/\sin\alpha$ also does.
Hence we obtain that $|e^xf(x)|\leq M$ for $x$ in the upper half plane.
For $x$ on the real axis we also have $|e^xf(x)|\leq M$: For non-negative $x$ by assumption and choice of $M$, for negative $x$ because of $|f(x)|\leq Me^{|x|}$.
For $x$ in the lower half plane, we can conclude in exactly the same way, that
$|e^xf(x)|\leq M$.
Therefore $e^xf(x)$ is a bounded entire function and, by Liouville's theorem, it is a constant. Since the value at $x=0$ is 1 by assumption, we find that
$e^xf(x)=1$ and hence $f(x)=e^{-x}$. The uniqueness of the Taylor series yields $a_n=(-1)^n$.
Proof of the Theorem: Using a rotation in $\mathbb C$, we can assume that $\alpha=-\beta$. We choose $r>1$ such that $2r\beta<\pi$. For arbitrary $B>0$, we consider the function $g_B(z)=f(z)\exp\left(-B\,z^r\right)$ on $S$. Since $\mbox{Re }(z^r)\geq \gamma|z|^r$ with $\gamma=\cos(r\beta)>0$ on $S$, we find
$$|g_B(z)|\leq C\exp\left(C|z|-B\gamma\,|z|^r\right)\mbox{ on }S.$$
Therefore, if $R$ is sufficiently large, we have $|g_B(z)|\leq1$ for $z\in S$ with $|z|=R$.
Now $|g_B(z)|\leq1$ for $z$ on the boundary of $S_B=\{z\in S\mid|z|\leq R\}$. As $g_B$ is holomorphic in the interior of $S_B$, the maximum modulus principle applies and yields that $|g_B(z)|\leq1$ on $S_B$. Since $R$ can be chosen arbitrarily large, this is valid on the whole sector $S$. Thus we have proved for arbitrary $B>0$ that $|f(z)|\leq |\exp\left(B\,z^r\right)|$ on $S$.
Fixing $z$ and letting $B$ tend to 0, we obtain that $|f(z)|\leq 1 $ as desired.
