<s>[INST] Find all positive integers m,n and primes $p\geq5$ such that $m(4m^2+m+12)=3(p^n-1)$ I did it like this. We can manipulate  the equation  to come to
$\frac{(m^2+3)(4m+1)}{3}=p^n$
Now 3 divides either $(m^2+3) or (4m+1) $
If we assume 3 divides $(m^2+3)$ and it is equal to $(4m+1)$ (my intuition) .we get
$\frac{m^2+3}{3}=4m+1$.solving this we get $m=12$ we can substitute  back in equation to get $n=4:p=7$ which is correct. But i am not able to prove that 
$\frac{m^2+3}{3}=4m+1$. 
Please help me to complete my solution
 [/INST] This is a variation on John Omielan's answer, starting with the equation in the form $(m^2+3)(4m+1)=3p^n$. As John notes, each factor $m^2+3$ and $4m+1$ must contain a power of the prime $p$, since $m^2+3$ and $4m+1$ are both greater than $3$ if $m\ge1$.
Now using properties of the $\gcd$ relation, we see that
$$\begin{align}
\gcd(m^2+3,4m+1)
&=\gcd(m^2-12m,4m+1)\\
&=\gcd(m(m-12),4m+1)\\
&=\gcd(m-12,4m+1)\quad\text{(since }\gcd(m,4m+1)=1)\\
&=\gcd(m-12,49)
\end{align}$$
It follows that $p$ can only be $7$, $m$ must be congruent to $5$ mod $7$, and the smaller of the two powers of $7$ is either $7$ or $49$.  Now
$$m^2+3\ge{4m+1\over3}\quad\text{for all }m\ge1$$
so if $3\mid4m+1$ we must have $4m+1=3\cdot7$ or $3\cdot49$.  The former gives $m=5$, for which $m^2+3=28$ is not a power of $7$, while the latter gives $m=146/4$, which is not an integer.  Therefore we must have $3\mid m^2+3$. Now
$${m^2+3\over3}\ge4m+1\quad\text{for }m\ge12$$
Recalling that our gcd analysis showed that $m$ must be congruent to $5$ mod $7$, and that we've already seen that $m=5$ gives $m^2+3=28$, we see that $m=12$ is the only possible solution: $4\cdot12+1=49$ and $12^2+3=147=3\cdot49$.  In sum, $m=12$, $p=7$, and $n=4$ is the only solution (with positive integers $m$ and $n$ and prime $p$) to $m(4m^2+m+12)=3(p^n-1)$.
</s>