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 you have reason to believe the equation is satisfied by a positive integer $n\le5$, we can rule out the even integers $n=2$ and $4$ since $16-6e\approx-0.30969$ is negative.  For odd integers, a change of variable leaves the equation
$$I_n=\int_0^1 x^ne^{-x}dx=6-{16\over e}\approx0.1139$$
Now
$$1-x\le e^{-x}\le1-x+{1\over2}x^2\quad\text{for }0\le x\le1$$
which means
$$I_1\ge\int_0^1(x-x^2)dx={1\over2}-{1\over3}={1\over6}=0.1666\ldots$$
is too big, and
$$I_5\le\int_0^1(x^5-x^6+{1\over2}x^7)dx={1\over6}-{1\over7}+{1\over16}\approx0.0863$$
is too small.  So by the Goldilocks Principle, $n=3$ must be just right.
