Determine a positive integer $n\leq5$,such that $\int_{0}^{1}e^x(x-1)^ndx=16-6e$ Determine  a positive integer $n\leq5$,such that $\int_{0}^{1}e^x(x-1)^ndx=16-6e$.
I tried to solve it.But since $n$ is given to be $\leq$ 5,my calculations went lengthy.
Applying integration by parts repeatedly,we get
\begin{align}
\int e^x(x-1)^n \, dx &= \left[(x-1)^ne^x-n(x-1)^{n-1}e^x+n(n-1)(x-1)^{n-2}e^x \right. \\
& \hspace{5mm} \left.-n(n-1)(n-2)(x-1)^{n-3}e^x+n(n-1)(n-2)(n-3)(x-1)^{n-4}e^x \right. \\
& \hspace{5mm} \left.-n(n-1)(n-2)(n-3)(n-4)e^x\right]
\end{align}
\begin{align}
\int_{0}^{1}e^x(x-1)^n \, dx &= -n(n-1)(n-2)(n-3)(n-4)e-(-1)^n+n(-1)^{n-1}-n(n-1)(-1)^{n-2} \\ 
& \hspace{5mm} +n(n-1)(n-2)(-1)^{n-3}-n(n-1)(n-2)(n-3)(-1)^{n-4} \\
& \hspace{5mm} +n(n-1)(n-2)(n-3)(n-4) \\
&=16-6e
\end{align}
Now solving this is very difficult,is there another simple and elegant method to find $n=3.$

If we set
$$ I_n = \int_{0}^{1}e^x(1-x)^n\,dx = \int_{0}^{1}x^n e^{1-x}\,dx\tag{1}$$
integration by parts gives:
$$ I_{n+1} = -1 + (n+1)\, I_n\tag{2}$$
Since $I_0 = -1+e$, by using the previous formula and induction we have:
$$ \forall n\in\mathbb{N},\qquad I_n = A_n + B_n e,\quad A_n,B_n\in\mathbb{Z}\tag{3}$$
as well as
$$ B_n = n! \tag{4} $$
so the solution to the original problem is clearly $n=\color{red}{3}$.
