I am looking for integer solutions of Diophantine equation $m^2+1=5^n$. I found that $m=0,n=0$ and $m=2,n=1$. I could not find any other solutions. I try to prove this but I could not. Could anyone help me to solve this equation?

  • $\begingroup$ You mean $m \pm 2$. $\endgroup$
    – S.C.B.
    Mar 14, 2016 at 13:44
  • $\begingroup$ Yes I mean $m=\pm2$. $\endgroup$
    – user322725
    Mar 14, 2016 at 13:46
  • $\begingroup$ Is this for a contest? Seems difficult. Very (without Guassian Integers) Here is a similar question. $\endgroup$
    – S.C.B.
    Mar 14, 2016 at 13:48
  • $\begingroup$ I known that, I hope to see any solution, even advanced solution $\endgroup$
    – user322725
    Mar 14, 2016 at 13:51
  • $\begingroup$ A hint (maybe): $m \equiv$ 2 or 8 (mod 10) $\endgroup$
    – N.S.JOHN
    Mar 14, 2016 at 14:18

7 Answers 7


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$.

  • $\begingroup$ I like your idea, enough elementary. $\endgroup$
    – user322725
    Mar 15, 2016 at 5:29
  • $\begingroup$ Thank you (allow me say I like it too). By the way, the link given by Yiyuan Lee is extraordinary because it proves by elementary way something whose "nature" is not elementary. $\endgroup$
    – Piquito
    Mar 15, 2016 at 11:01

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$.

  • $\begingroup$ Can you provide a link to the theorem? There is no proof in the given link $\endgroup$
    – N.S.JOHN
    Mar 14, 2016 at 14:28
  • $\begingroup$ @YiyuanLee I don't think what you refer to is a valid proof... $\endgroup$ Mar 14, 2016 at 14:44
  • $\begingroup$ Here is a thread regarding the proofs of the theorem : math.stackexchange.com/questions/766199/… $\endgroup$
    – Yiyuan Lee
    Mar 14, 2016 at 14:46
  • $\begingroup$ @YiyuanLee Take a look at this question of mine as well math.stackexchange.com/q/1139398/127263 $\endgroup$
    – Wojowu
    Mar 14, 2016 at 16:03
  • $\begingroup$ The original proof is titled "Primary Cyclotomic Units and a Proof of Catalan's Conjecture" (Mihăilescu, 2004) but unfortunately I am unable to get hold of a softcopy of it. $\endgroup$
    – Yiyuan Lee
    Mar 14, 2016 at 16:15

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$).


Note: This is building on Yiyuan Lee's answer, which suggested applying Catalan's conjecture / Mihăilescu's theorem (CCMT).

We start with $$ m^2 + 1 = 5^n \quad (m, n) \in \mathbb{Z}^2 $$ and rewrite it as $$ 5^a - y^2 = 1 \quad (a, y) \in \mathbb{Z}^2 \quad (*) $$ to compare it with CCMT's $$ x^a - y^b = 1 $$

Case 1:

CCMT says for natural numbers $a,b,x,y$ with $a, b > 1$, $x, y > 0$ there is only the solution $$ 3^2 - 2^3 = 1 $$ This means there is no solution for $(*)$ for $(a,y) \in \mathbb{Z}^2$, $a > 1$, $y > 0$.

Case 2:

We can drop the case $y < 0$, as $$ 1 = 5^a - y^2 = 5^a - (-(-y))^2 = 5^a - (-y)^2 $$ so no new solutions are possible.

Case 3:

The case $y = 0$ leads to $$ 5^a = 1 $$ which has no solution for $a > 1$. We covered $a > 1$, $y \in \mathbb{Z}$ so far.

Case 4:

For $a = 1$, $y \in \mathbb{Z}$ we have $$ 5 - y^2 = 1 \iff \\ y^2 = 4 \iff \\ y = \pm 2 $$ which gives the solutions $(a,y) = (1, \pm 2)$. This has covered $(a,y) \in \mathbb{N} \times \mathbb{Z}$.

Case 5:

For $a = 0$, $y \in \mathbb{Z}$ we have $$ 1 - y^2 = 1 \iff \\ y^2 = 0 \iff \\ y = 0 $$ which gives the addtional solution $(a,y) = (0,0)$. Covered so far: $\mathbb{N}_0 \times \mathbb{Z}$.

Case 6:

Now going for $a < 0$, $(a, y) \in \mathbb{Z}^2$. We get $$ 5^a - y^2 = 1 \iff \\ 5^{-(-a)} - y^2 = 1 \iff \\ \underbrace{\frac{1}{5^{-a}}}_{< 1} = \underbrace{1 + y^2}_{\ge 1} $$ so no additional solution is possible.


First of all, $y\ge0$, and an even $y$ it may be only in the case of $y=0$ -- when the difference between the squares of numbers is equal to 1. In all other cases $y$ odd. Let $z=5^{(y-1)/2}$ and consider the diophantine equation $x^2+1=5z^2$. It has an infinite number of solutions, but they can be clearly described, and then verify that $z$ may be a power by 5 only for the case $z=1$.

If $(x,z)$ -- solution of the equation, then the same holds for the pair $(9x+20z,4x+9z)$. Really, $5(4x+9z)^2-(9x+20z)^2=5z^2-x^2=1$. According to this rule, from the initial decision $(2;1)$ continue to receive a pair of $(38;17)$, $(682;305)$, ... and so on. Making components at the same time satisfy the recurrence relation $z_{n+2}=18z_{n+1}-z_n$ at $n\ge0$, where $z_0=1$, $z_1=17$.

For starters check that this series describes all the solutions of the equation in positive integers. Consider the inverse transformation $(x,z)\mapsto(9x-20z,-4x+9z)$, is also it takes a decision in the decision. It provides solutions in positive integers if $\frac{x}z\in(\frac{20}9;\frac94)$, and both coordinates in such a transformation are reduced. It is easy to check that out $\frac{x}z\le\frac{20}9$ must be $z\le4$, and a decision to this limitation, we have only one, where $z=1$. It is also understood that $x^2 < 5z^2 < \frac{81}{16}z^2$, and inequality $\frac{x}z < \frac94$ it is always satisfied.

Thus, any solution in a finite number of steps the reverse transformation to $(2;1)$, which implies a complete description.

Now consider the sequence of values $z_m$, given by the recurrence relation: $1$, $17$, $305$, $5473$, ... . We are interested in those values, which are divided into $5$. Considering the sequence modulo 5, we have 1, 2, 0, 3, 4, 4, 3, 0, 2, 1, 1, 2, ... , wherein the period is 10, and multiples of 5, meet for a period of 5 $n=5m+2$.

The number 305, which we meet here, is also divided by 61. It is therefore natural to check the residues modulo 61. In this module we have the following: 1,17,0,44,60,60,44,0,17,1, 1.17, ..., that is also equal to period 10, and zeros are exactly the same places. This means that all the sequence numbers that are multiples of 5, as a multiple of 61 and 5 degrees among them.


Here's a long solution that uses Pell equations.


$m^2+1$ is an integer, therefore $n\ge 0$.

There are two cases.

$1) $ $n$ is even. $n=2k$, $k\ge 0$. Then $\left(5^k+m\right)\left(5^k-m\right)=1$.

WLOG let $m\ge 0$, because $m$ is a solution if and only if (iff) $-m$ is a solution.

If $m\ge 1$, then $5^k+m>1$, contradiction. Therefore $m=0$, $(m,n)=(0,0)$.

$2) $ $n$ is odd. $n=2k+1$, $k\ge 0$. Let $y=5^k$, $m=x$.

Then $x^2-5y^2=-1$ looks like a Pell equation.

$(x_1,y_1)=(\pm 2,\pm 1)$. See my answer here for how to solve Pell equations.

In particular, the solution given in http://vjimc.osu.cz/history 2015 Category II Solutions Problem 2 is very similar, analogous to what I'll do here. I've also posted an analogous answer here.

The solutions, in this case, are given by $$x_v=\pm \frac{(2+\sqrt{5})^{2v-1}+(2-\sqrt{5})^{2v-1}}{2}$$

$$y_v=\pm \frac{(2+\sqrt{5})^{2v-1}-(2-\sqrt{5})^{2v-1}}{2\sqrt{5}}$$

$v=1,2,\ldots$ $$2\sqrt{5}\cdot 5^k=(2+\sqrt{5})^{2v-1}-(2-\sqrt{5})^{2v-1}$$

Clearly $(2+\sqrt{5})^{2v-1}>(2-\sqrt{5})^{2v-1}$.

If $k=0$, then $n=1$, $(m,n)=(\pm 2,1)$. Let $k\ge 1$.

$$5^k=\binom{2v-1}{1} 4^{v-1}+\binom{2v-1}{3} 4^{v-2}\cdot 5+$$

$$+\cdots+\binom{2v-1}{2v-1} 5^{v-1}$$

$$\implies 2v-1\equiv 0\pmod{5}$$

$(2v-1)/5$ is odd.

$$2\sqrt{5}\cdot 5\cdot 61=(2+\sqrt{5})^{5}-(2-\sqrt{5})^{5}\mid$$

$$\mid (2+\sqrt{5})^{2v-1}-(2-\sqrt{5})^{2v-1}=2\sqrt{5}\cdot 5^k,$$

contradiction. I think this divisibility result is true.

How do I know that $$b_5:=(2+\sqrt{5})^5+(2-\sqrt{5})^5\mid $$

$$\mid (2+\sqrt{5})^{2v-1}+(2-\sqrt{5})^{2v-1}=:b_{2v-1}?$$

((($:=$ denotes "equal by definition")))

Here I used $+$ instead of $-$.

Well, the solution of $5^n=6m^2+1$ which I gave in the beginning of this answer uses this

and also see this link from AoPS. I won't be self-contained here.

v_Enhance said that, in this case: "$b_{2v-1}/b_5$ is both rational and an algebraic integer."

Kent Merryfield has a longer answer, which you should see for yourself.


There are no non-trivial positive integer solutions to $m^2+1=5^n$. We can show this using fairly elementary methods.

As others have noted, $n$ must be odd. If $n=2r$ then
$1 = (5^r)^2 - m^2 = (5^r + m)(5^r - m)$, which is only true for $r=m=0$

Let $n=2r+1$. $$m^2+1=5^{2r+1}$$ $$m^2 - 5(5^r)^2 = -1$$ This is the negative Pell's equation $$m^2 - 5x^2 = -1$$ with $x = 5^r$, which can be factorised as $$(m + \sqrt5 x)(m - \sqrt5 x) = -1$$

By inspection, its smallest solution is $$2^2 - 5\cdot1^2 = -1$$ For odd $k$, $(-1)^k = -1$, so we can obtain all solutions from $$(2 + \sqrt5)^k(2 - \sqrt5)^k = -1$$ Now $(2 + \sqrt5)^2 = 9 + 4\sqrt5$, and $$(9 + 4\sqrt5)(m + \sqrt5 x) = (9m + 20x) + \sqrt5(4m + 9x)$$ So from a solution pair $(m, x)$ we can obtain the next solution pair
$(9m + 20x, 4m + 9x)$. Here are the first 20 solutions:

m x
2 1
38 17
682 305
12238 5473
219602 98209
3940598 1762289
70711162 31622993
1268860318 567451585
22768774562 10182505537
408569081798 182717648081
7331474697802 3278735159921
131557975478638 58834515230497
2360712083917682 1055742538989025
42361259535039638 18944531186571953
760141959546795802 339945818819306129
13640194012307284798 6100080207560938369
244763350261984330562 109461497917277584513
4392100110703410665318 1964206882303435582865
78813038642399407645162 35246262383544562907057
1414242595452485926947598 632468516021498696744161

Note the cyclic pattern in the final digit. As Roman83 remarks, we can also write this recurrence relation in this form: $z'' = 18z' - z$. That formula applies to both $m$ and $x$. Thus both the $m$ and $x$ sequences are Lucas sequences of the first kind (generalised Fibonacci sequences) and have the usual properties of such sequences. In fact, the $x$ sequence is $\text{Fibonacci}(6n+3)/2$, aka A007805; the $m$ sequence is $\text{Lucas}(6n-3)/2$, A075796.

Now $x = 5^r$, so we need to find a Fibonacci number which is twice a perfect power of 5. The Fibonacci numbers are a strong divisibility sequence, i.e. $\gcd(F_u, F_v) = F_{\gcd(u, v)}$. That can be proven using the simpler property that $F_u | F_{uv}$, which is proved here.

In what follows, assume $u, v > 2$, so we can ignore $F_1 = F_2 = 1$.

If $F_u | F_v$ then $\gcd(F_u, F_v) = F_{\gcd(u, v)} = F_u$,
i.e., $u = \gcd(u, v)$, and hence $u | v$. Thus $F_u | F_v \iff u | v$.
In other words, $F_v \equiv 0 \pmod {F_u} \iff v \equiv 0 \pmod u$

Now, $F_0 = 0, F_3 = 2, F_5 = 5$, so all $F_{3k} \equiv 0 \pmod 2$ and $F_{5k} \equiv 0 \pmod 5$. Thus $10 | F_{15}$, and if we look at the list of Fibonacci numbers we see that, in fact, $F_{15} = 610$ is the smallest $F_n$ divisible by 10. So $10 | F_n \iff 15 | n$, but we have a problem because $F_{15} | F_{15k}$ so $10 | F_n \implies 61 | F_n$, and so $F_n$ cannot be twice a perfect power of 5. Hence there are no solutions to $x = 5^r = F_n/2$ and thus there are no non-trivial positive integer solutions to $m^2+1=5^n$.

I should mention that according to Carmichael's theorem, "With the exceptions of 1, 8 and 144 ($F_1 = F_2, F_6 \text{ and } F_{12}$) every Fibonacci number has a prime factor that is not a factor of any smaller Fibonacci number". That immediately rules out any $F_n$ being twice a perfect power of 5, but I don't know of an elementary proof of Carmichael's theorem.

  • $\begingroup$ FWIW, this answer was written in response to this question. $\endgroup$
    – PM 2Ring
    Aug 2, 2018 at 11:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.