On equations $m^2+1=5^n$

Hint: By Mihăilescu's theorem the only solution to

$$x^a - y^b = 1$$

where $a, b > 1$ and $x, y > 0$ is

$$3^2 - 2^3 = 1$$

Now you only have to consider the remaining cases where the exponents are not both more than $1$, and where the bases are not both more than $0$.


HINT.-If you are interested in another way of indicated in the link given by Yiyuan Lee (a good example of that elementary could be intricate enough and not easy), you could pay attention to the following:

$m^2+1=5^n\Rightarrow n$ is odd ($m^2+1=x^2$ is impossible since the difference between $x^2$ and the square of an integer greater than $x$ is always greater or equal than $2x+1>1$).

So we have the equation $$m^2+1=5x^2\iff m^2-5x^2=-1\quad (*)$$ The Pell-Fermat equation $(*)$ has infinitely many solutions but we have to discriminate these solutions with the restriction $x$ must be a power of $5$.

It is known in Algebraic Number Theory (it is not hard to calculate) that the fundamental unit of $\mathbb Q[\sqrt 5]$ is $\frac{ 1+\sqrt 5}{2}$ so all the solutions $(m_n,x_n)$ of $(*)$ are given by $$m_k+x_k\sqrt 5=\left(\frac{ 1+\sqrt 5}{2}\right)^k; k\ge 1\qquad (**)$$
Calculation gives $$2^k(m_k+x_k\sqrt 5)=(1+\sqrt 5)^k=1+\binom k1\sqrt 5+\binom k2(\sqrt 5)^2+\binom k3(\sqrt 5)^4+…..+\binom k2(\sqrt 5)^{k-2}+\binom k1(\sqrt 5)^{k-1}+(\sqrt 5)^k$$ Hence you have according if $k$ is even or odd $$2^{2k}x_{2k}=\binom {2k}1+5\binom {2k}3+5^2\binom {2k}5+5^3\binom {2k}7+…..5^{k-1}\binom {2k}1$$ $$2^{2k+1}x_{2k+1}=\binom {2k+1}1+5\binom {2k+1}3+5^2\binom{2k+1}5+5^3\binom {2k+1}7+…..+5^{k-1}\binom {2k+1}2+5^k$$ I leave to you the task of verifying that it is not possible that any $x_k$ is a power of $5$.


Since $(1+mi)(1-mi)=(1+2i)^n(1-2i)^n$, we must have $1+mi=(1+2i)^n$ or $1-mi=(1+2i)^n$. If both $1+2i$ and $1-2i$ divide either $1+mi$ or $1-mi$, then $5$ would divide it, too, which is impossible since $5\nmid1$.

In this answer, it is shown that for $n\ge2$, $\mathrm{Re}\left((1+2i)^n\right)\ne1$.

Therefore, $m^2+1=5^n$ can only have solutions for $n=0$ ($m=0$) and $n=1$ ($m=2$).