# Solving a Diophantine equation: $p^n+144=m^2$

I found this Diophantine equation: $$p^n+144=m^2$$ where $m$ and $n$ are integers and $p$ is a prime number. I solved it but I want to know if there exist other proofs through the use of rules of modular arithmetic.

This is my solution: $$p^n+144=m^2$$ $$p^n=(m+12)(m-12)$$

With $(m+12)>(m-12)$ and $m-12$ is a divisor of $m+12$ because $m+12=p^x$ and $m-12=p^y$ with $n=x+y$ and $y<x$. Now if $m-12$ is a divisor of $m+12$, $\frac {m+12} {m-12} \ge 2$. If $\frac {m+12} {m-12} =2$, $m=36$ therefore $12<m<37$ and $24<m+12<49$. We can note that the only powers of prime numbers between values of $m+12$ are $25$, $27$ and $32$. By substitution we can find all possible values of $p$, $n$ and $m$.

• I'd go, $m\pm12$ are both powers of $p$, so $p^r-p^s=24$. If $s=0$ we get $(m,n,p)=(13,2,5)$. Otherwise, we have $p$ divides $24$, so $p$ is $2$ or $3$, and you just have to check when two powers of $2$ differ by $24$, and when two powers of $3$ differ by $24$. Apr 10, 2015 at 9:21
• Very well👍. Thanks Apr 10, 2015 at 9:42

This gives us $m+12=p^a$ and $m-12 = p^b$. This means $p^a-p^b = 24$, i.e., $p^b(p^{a-b}-1) = 24 = 2^3 \cdot 3$. Note that $p^b$ and $p^{a-b}-1$ are of opposite parity.
• If $b=0$, we need $p^a-1 = 24 \implies p^a = 25 \implies p = 5,a=2$. Hence, $m=13$.
• If $b>0$, we need $p^b \mid 24$. Hence, $p=2$ or $p=3$.
• If $p=2$, we have $p^{a-b}-1$ to be odd. Hence, this means $p^{a-b}-1=3$ and $p^b=2^3$. This gives us $b=3$ and $a-b=2$, i.e., $a=5$. This gives us $m=20$.
• If $p=3$, we have $p^b=3$ and $p^{a-b}-1=2^3$. Hence, $b=1$ and $a-b=2$, i.e., $a=3$. This gives us $m=15$.
Hence, the solutions are ${\color{blue}{(m,p,n) = (13,5,2)}}$, ${\color{blue}{(m,p,n) = (20,2,8)}}$ and ${\color{blue}{(m,p,n) = (15,3,4)}}$.