n! as a product of $3$ consecutive integers How can I know if there exist three consecutive integers $a$, $b$ and $c$ such that $a$.$b$.$c$ = $n$!. I am supposed to write an algorithm for this so using $n$! or trying to find $a,b,c$ do not work.
 A: Let $m=\lfloor\sqrt[3]{n!}\rfloor$.  Since you are looking for three consecutive integers whose product $(k-1)k(k+1)$ is $n!$, you need only consider $k=m$ and $k=m+1$.  That's because you can't have $k-1\gt\sqrt[3]{n!}$ nor $k+1\lt\sqrt[3]{n!}$.  (Note, $n!$ is never a perfect cube for $n\gt1$.  This easily follows from Bertrand's Postulate, and possibly for other, more elementary reasons.)
For example, $\sqrt[3]{3!}=1.817$, for which $k=2$ works, $\sqrt[3]{4!}=2.884$, for which $k=3$ works, $\sqrt[3]{5!}=4.932$, for which $k=5$ works, $\sqrt[3]{6!}=8.96$, for which $k=9$ works, but $\sqrt[3]{7!}=17.145$, for which neither $k=17$ nor $k=18$ works (because in either case $17$ is a factor of $(k-1)k(k+1)$ but not a factor of $7!$).
A: Assume that $n!$ is the product of three consective integers: $k-1,k,k+1.$ In such a case, it is $$k^3-k-n!=0.$$
So, you have to check if the equation $x^3-x-n!=0$ has an integer solution $k.$ In such a case $n!=(k-1)k(k+1).$
How to implement this in an algorithm? Well, since $k^3-k=n!<k^3$ it is enough to consider values $k>\sqrt[3]{n!}.$ On the other hand it is
$$k^3-k=n!\implies k^3=n!+k<n!+n\implies k<\sqrt[3]{n!+n}.$$
So, a possible way is to test if for $\sqrt[3]{n!} < k <\sqrt[3]{n!+n}$ it is $k^3-k-n!=0.$ 
