What is the lowest value of $m$ if $m>2$ and $m^3-3m^2+2m$ is divisible by $79$ and $83$? 
$m^3-3m^2+2m$ is divisible by $79$ and $83$ where $m>2$. Find the
lowest value of $m$

$m^3-3m^2+2m$ is the product of three consecutive integers. Both $79$ and $83$ are prime numbers. The product of three consecutive positive integers is divisible by $6$. So, $m^3-3m^2+2m$ is a multiple of $lcm(6,79,83)=39342$. But I can't go any further.
What would be the correct approach to solve problems like this?
 A: The brute force method: as $m^3−3m^2+2m=m(m−1)(m−2)$, and $79,83$ are prime, you can just solve the following nine congruences: $m\equiv\alpha\pmod{79}$, $m\equiv\beta\pmod{83}$, where $\alpha,\beta\in\{0,1,2\}$. This is possible as per Chinese Remainder Theorem, and the smallest of the nine $m$'s you will get (greater than $2$) is the solution.
It is easy to solve all those congruences simultaneously: per Wikipedia, we first express $1$ as $1=79u+83v$, where $u,v$ can be found using Euclidean algorithm. In this case, as $4=83-79$ and $1=20\cdot 4-79$, we have $1=20\cdot 83-21\cdot 79$.
Now, $m\equiv\alpha\pmod{79}$ and $m\equiv\beta\pmod{83}$ resolves as $m\equiv 20\cdot 83\alpha-21\cdot 79\beta\pmod{79\cdot 83}$, i.e. $m\equiv 1660\alpha-1659\beta\pmod{6557}$. This gives us the following table:
$$\begin{array}{r|r|r|r}\alpha&\beta&m\pmod{6557}&\text{smallest }m\gt 2\\\hline0&0&0&6557\\0&1&4898&4898\\0&2&3239&3239\\1&0&1660&1660\\1&1&1&6558\\1&2&4899&4899\\2&0&3320&3320\\2&1&1661&1661\\2&2&2&6559\end{array}$$
so the smallest solution seems to be $m=1660$.
A: You computed some admissible number (if you take the correct value for $m$) in the comments. Now you can just let the computer test all the smaller cases
m=np.arange(5000)
x=m*(m-1)*(m-2)
m[(x%83==0) & (x%79==0)]

which gives the result
[   0,    1,    2, 1660, 1661, 3239, 3320, 4898, 4899]

from where you see that there are indeed smaller admissible candidates, as $1660=20\cdot 83$ and $1659=21\cdot79$.
