<s>[INST] How to solve this number theory question from INMO? 
Solve the following equation in integers:
$$m(4m^2 + m + 12) = 3(p^n -1)$$
where $m$ and $n$ are integers and $p$ is a prime greater than equal to 5.

This simplifies to :
$$4m^3 + m^2 + 12m + 3 = (4m + 1)(m^2 + 3) = 3p^n$$
$\gcd(4m+1,m^2 +3)$ is greater than 1 because if it were so then we get only 4 possibilities in every case of which we get one of the numbers to be less than 4, which is not possible.
Moreover, $$(4m+1,m^2 + 3) = (4m + 1, 16m^2 + 48) = (4m + 1,49) = 7\text{ or }49$$
This means the prime $p$ is 7. and $4m + 1 = 3*7^k\text{ or }7^k$
If $\gcd(4m+1,49) = 7$ then $k=1$ and $4m+1 = 21$ which doesnt give any solution.Therefore $\gcd(4m+1,m^2 + 3) = 49$. If $7^3$  divides $4m + 1$ then it doesn't divide $m^2 + 3$, and then the solution says that we get $$m^2 + 3 \leq 3*7^2 < 7^3 \leq 4m + 1$$
How do we arrive at the above inequality chain?
 [/INST] Since $m^2+3 =7^l$ or $m^2+3= 3\cdot 7^l$ we see that $m^2+3 \leq 3\cdot 7^l$ 
Now we have $7^2\mid m^2+3$ and $7^3\not{\mid} \;m^2+3$ so $l=2$. 
And since $7^3\mid 4m+1$ we have $7^3\leq 4m+1$. Clearly $3\cdot 7^2<7^3$.
</s>