Find the least positive integer $m$ such that $m^2 - m + 11$ is a product of at least four not necessarily distinct primes. Find the least positive integer $m$ such that $m^2 - m + 11$ is a product of at least four not necessarily distinct primes.
I tried but not able to solve it.
Edit : Please note that I am looking for mathematical solution not the programming one.
 A: Let the equality $$m(m-1)+11=N$$ It is clear that $N$ must be odd and that can be divisible by the prime $11$. However the following congruences have no solution as it is easy to prove directly checking the few possibilities with $m(m-1)$ not divisible by $3,5$ and $7$ respectively
$$\begin{cases}m(m-1)+2\equiv 0\pmod3\\m(m-1)+1\equiv 0\pmod5\\m(m-1)+4\equiv 0\pmod7\end{cases}$$
Thus $N=\prod p_i^{a_i}$ with $p_i\ge11$.
A necessary condition is that (solving the quadratic in $m$) $$\sqrt{4N-43}=x^2$$ and from this we need that $$N\equiv 1,3,7\pmod{10}$$ By chance we find the minimum $N=11^3\cdot13$ which corresponds to $\color{red}{m=132}$ and that could have been calculated by direct trials but the next solution seems to be far from $132$.
A: $$132^2 - 132 + 11 = 11 \times 11 \times 11 \times 13$$
Pyth program:
f<3lP+*TtT11

A: By checking the choices $m=0,1,\ldots,p-1$, you can show that $m^2-m+11$ is never divisible by $p$ when $p=2,3,5$ or $7$. So the smallest possible product of four primes is $11^4$. The next smallest is $11^3\cdot 13$. (Taking a peek at Kenny Lau's answer). All you need to do is to check that
$$m^2-m+11=11^4$$
has no integer solutions, but
$$m^2-m+11=11^3\cdot13$$
does.
