Solution (source code)

= Solution

From $3H\dot\phi=-c^2V'$ and $H^2=8\pi GV/(3c^2)$,
$$
\frac{\dot\phi^2}{2c^2}
=\frac{c^2V'^2}{18H^2}
=\boxed{\frac{c^4n^2V(\phi)}{48\pi G\phi^2}}.
$$
The <slow-roll approximation> fails when this kinetic contribution is comparable with $V$, giving
$$
\boxed{\phi_{\rm end}\simeq
\frac{nc^2}{\sqrt{48\pi G}}}.
$$

The number of e-folds is
$$
N_e=\log\frac{a_{\rm end}}{a_i}
=\frac{4\pi G}{c^4n}
(\phi_i^2-\phi_{\rm end}^2).
$$
Using the estimate above,
$$
N_e\simeq\frac n{12}
\left[\left(\frac{\phi_i}{\phi_{\rm end}}\right)^2-1\right].
$$
For $n=6$ and the roughly $60$ e-folds needed for the flatness problem,
$$
\boxed{\phi_i\simeq11\phi_{\rm end}}.
$$
This is the <monomial slow-roll e-fold count>.