Solution (source code)

= Solution

\b[No.] A standard counterexample comes from the <log-normal distribution>. Let
$$
f(x)=\frac1{x\sqrt{2\pi}}
\exp\left(-\frac{(\log x)^2}{2}\right),
\qquad x>0,
$$
and, for a fixed $0<|\varepsilon|\leq1$, let
$$
f_\varepsilon(x)
=f(x)\left[1+\varepsilon\sin(2\pi\log x)\right].
$$
This is a nonnegative density distinct from $f$. For every nonnegative integer $n$, substituting $z=\log x$ makes the difference of the $n$th moments proportional to
$$
\mathbb E[e^{nZ}\sin(2\pi Z)],
\qquad Z\sim N(0,1).
$$
It is the imaginary part of
$$
\mathbb E[e^{(n+2\pi i)Z}]
=\exp\left(\frac{(n+2\pi i)^2}{2}\right),
$$
which vanishes because its phase is $2\pi n$. The case $n=0$ also proves that $f_\varepsilon$ is normalized. Thus the two distributions have every finite moment equal but are different. Unbounded random variables need not be determined by their moments.