Let $a<b$. When there is a smooth, strictly positive function $f$ on $[a,b]$ such that for any $n\in\mathbb Z, n\geq 0$ we have:
$$m_n(d\mu):=\int_{a}^bx^nd\mu \in\mathbb Z,$$
where $d\mu=f(x)dx$.
When $a=-1, b=1$ this is clearly impossible as $0<m_n(d\mu)$ and $m_n(d\mu)\to0$.
When $a=-2, b=2$ there is non-trivial example
\begin{equation} \dfrac 1{2\pi}\int\limits_{-2}^2\sqrt{4-x^2}x^k= \begin{cases} C_{k/2}, & \text{if}\ k\ \text{even} \\ 0, & \text{otherwise} \end{cases} \end{equation} Here $C_k$ is Catalan numbers.
When $a=0, b=+\infty$ we can take $f(x)=e^{-x}$.
Can we construct such a measure when $b-a < 4$?