<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] You have that
$$\frac{(m^2+3)(4m+1)}{3}=p^n \tag{1}\label{eq1A}$$
I don't see any particular way to directly prove your assumption that $\frac{m^2 + 3}{3} = 4m + 1$. Instead, here is a proof it's the only solution, so your assumption is true in that manner.
Since both $m^2 + 3$ and $4m + 1$ are $\gt 3$ for positive integers $m$, and they contain just $1$ factor of $3$, then both terms must contain at least one factor of $p$. Let
$$d = \gcd(m^2 + 3, 4m + 1) \tag{2}\label{eq2A}$$
Also, you have that
$$\begin{equation}\begin{aligned}
d \; \mid \; & 16(m^2 + 3) - (4m - 1)(4m + 1) \\
& = 16m^2 + 48 - 16m^2 + 1 \\
& = 49
\end{aligned}\end{equation}\tag{3}\label{eq3A}$$
As $p \mid d$, this means $p = 7$. There are thus $2$ basic possibilities depending on which term has a factor of $3$. First, consider for some positive integers $i,j$ where
$$m^2 + 3 = 3(7^i) \implies m^2 = 3(7^i - 1) \tag{4}\label{eq4A}$$
$$4m + 1 = 7^j \implies m = \frac{7^j - 1}{4} \tag{5}\label{eq5A}$$
From \eqref{eq3A}, you have that
$$\begin{equation}\begin{aligned}
49 & = 16(m^2 + 3) - (4m - 1)(4m + 1) \\
& = 16(3)(7^i) - (7^j - 2)(7^j) \\
& = 48(7^i) - (7^j - 2)(7^j)
\end{aligned}\end{equation}\tag{6}\label{eq6A}$$
Since the left side is $49 = 7^2$, then $i$ and/or $j$ must be $\le 2$ since, otherwise, the right side would have more than $2$ factors of $7$. If $i = 1$, you have $m^2 = 18$, which gives a non-integral $m$. If $i = 2$, then $m^2 = 144 \implies m = 12$, which is the result you already have. For $i \gt 2$, then $j \le 2$, so consider \eqref{eq5A}. For $j = 1$, you get $m = \frac{6}{4}$, which is not an integer. Finally, for $j = 2$, you get $m = 12$, which has already been accounted for.
Next, consider the second factor is a multiple of $3$ instead, i.e., there are some positive integers $k,q$ where
$$m^2 + 3 = 7^k \implies m^2 = 7^k - 3 \tag{7}\label{eq7A}$$
$$4m + 1 = 3(7^q) \implies m = \frac{3(7^q) - 1}{4} \tag{8}\label{eq8A}$$
Now, from \eqref{eq3A}, you have
$$\begin{equation}\begin{aligned}
49 & = 16(m^2 + 3) - (4m - 1)(4m + 1) \\
& = 16(7^k) - (3(7^q) - 2)(3)(7^q)
\end{aligned}\end{equation}\tag{9}\label{eq9A}$$
Similar to before, $k$ and/or $q$ must be $\le 2$. Note $k = 1$ gives $m^2 = 4 \implies m = 2$. However, this means from \eqref{eq8A} that $7^q = 3$, which doesn't give an integral $q$. With $k = 2$, \eqref{eq7A} gives $m^2 = 46$, so $m$ is not an integer. For $k \gt 2$, you have $q \le 2$, so consider \eqref{eq8A}. For $q = 1$, you get $m = 5$. However, from \eqref{eq7A}, you get $7^k = 28$, so $k$ is not an integer. Finally, for $q = 2$, you get $m = \frac{146}{4}$, which is not an integer.
Thus, in summary, there is only the one solution you already found, i.e., $m = 12$, $n = 4$ and $p = 7$.
</s>