# Solve the following equation where $p$ is prime: $p^n + 144 = m^2$

It is given that $p$ is a prime number, and that $m$ and $n$ are positive integers. Solve the following equation and determine all values for $m$, $n$ and $p$.

$$p^n + 144 = m^2$$

## 1 Answer

Solution

$p^n + 144 = m^2 \Leftrightarrow p^n=m^2-144=(m+12)(m-12)\\ \because p \text{ is prime (non-factorisable)}, \\ \therefore(m+12) = p^a, (m-12) = p^b, a,b \in \mathbb N\\ \text{moreover: } a>b\\ \implies \frac{m+12}{m-12}=p^{a-b} >0\\ \implies 1+\frac{24}{m-12}=p^{a-b}>0\\ \implies m-12>0\\ \implies m-12=1,2,3,4,6,8,12,24\\ \implies m = 13,14,15,16,20,24,36\\ \text{by method of exhaustion, the only suitable values of$m$are: 13,15,20}\\ \therefore \text{the possible values for$(m,n,p)$are: } (13,2,5), (15,4,3), (20,8,2)$

• Glad you found the bug in your code. (I might have left the question about the discrepancy with the code output so that other answers would retain their context.) – Eric Towers Mar 9 '18 at 2:25