I would like to find a sufficient condition on two polynomials $P(s)$ and $Q(s)$, such that the function $s \mapsto Q(s)e^{P(s)} $ has a primitive integral of the form $s \mapsto R(s)e^{P(s)} $ (with $R(s)$ a polynomial in $\mathbb R[s]$).
For instance I believe that $e^{s^2}(a_3 s^3+a_2 s^2+a_1 s+a_0)$ has a primitive integral of the form $s \mapsto R(s)e^{s^2} $ if $a_2 = 2a_0$. But what would be the sufficient condition in a general case ?
Thank you !