Is there a solution to $A^N+B^N=C^N \pm 1$ where $A,B,C,N\in\Bbb{N}$, such that $A,B,C > 1,N \geq 4$ and $gcd(A,B)=gcd(B,C)=gcd(A,C)=1$?

This question was inspired by this one: $A^X+B^Y=C^Z\pm 1$ Beal's conjecture "almost" solutions

A related question was asked here before.

Noam Elkies has published a paper on this subject. The table on page 15 of the paper and his extended table here have some interesting results. If I understood his work correctly, there are no solutions for $4 \leq N \leq 20$ and $C < 2^{23}=8,388,608$.

I also found a MathWorld article on 4th order diophantine equations, but it doesn't cover equations of this form. I also checked that the OEIS has no sequences for such Fermat near misses.

  • $\begingroup$ I am also happy to see solutions without the gcd constraint. $\endgroup$ Feb 8, 2021 at 5:35
  • 2
    $\begingroup$ And very interesting question! Can you share what progress you have made? Have you found any relevant literature on the problem? Can you show that $A\neq B$ for any solution? $\endgroup$
    – Servaes
    Feb 8, 2021 at 16:26
  • 1
    $\begingroup$ For the case $A = B$, $n = p \equiv 1 \pmod 4$, see Theorem 4 in this paper of Ribet: arxiv.org/pdf/math/9508208.pdf. (Also see his note just below that about removing the 1 mod 4 hypothesis with more work on non-split Cartan subgroups. I don't know if that has been accomplished yet.) $\endgroup$ Feb 8, 2021 at 17:39
  • 1
    $\begingroup$ The comments to this question suggest that there are no known solutions for $n>4$. $\endgroup$
    – Servaes
    Feb 8, 2021 at 22:06
  • 1
    $\begingroup$ @Servaes I have updated the question to show what I have tried so far. $\endgroup$ Feb 9, 2021 at 6:41

1 Answer 1


This exact question was a summer research project of mine when I was a second-year undergraduate in 2013. It was inspired by infinitely many solutions parametrized by Ramanujan in the $n=3$ case. I didn't make much progress, but I can show you a conditional result that I found, and some slight progress in the even case (with help from Noam Elkies, if I recall correctly). I haven't look at this in 7 years, so please verify independently if the propositions are true.

Abstract. Srinivasa Ramanujan wrote down in his Lost Notebook infinitely many non-trivial examples of integers $x,y,z$ such that $x^3+y^3=z^3\pm 1$, for each sign. Aside from his miraculous construction, the result itself is remarkable as it shows that the smallest perturbation of Fermat's famed equation of degree $3$, which has been known since the time of Euler to have no solutions, has infinitely many solutions. We study the natural generalization $a^n+b^n=c^n\pm 1$, which we call the Fermat-Ramanujan equation.

Definition 1. Let $x\in\mathbb{Z}$ be non-zero. Then there exists a unique prime factorization $x=\pm\prod_{i=1}^{s}{p_i^{e_i}}$, where the $p_i$ are distinct ascending primes and the $e_i$ are positive integers. Then define, for each $k\in\mathbb{Z}^+$, the $k$-radical of $x$ to be $$\text{rad}_k (x)=\prod_{i=1}^{s}{p_i^{\min(e_i,k)}}.$$

Note that for $k=1$, this is the classic radical function $$\text{rad}_1 (x)=\prod_{i=1}^{s}{p_i^{\min(e_i,1)}=\prod_{i=1}^{s}{p_i}}=\text{rad}(x).$$

Hu-Yang Conjecture. Let $\{a_i\}_{i=0}^{m}$ be integers with $m\ge 2$, such that $\begin{cases} \gcd(a_0,a_1,\ldots, a_m) =1\\ a_1+\cdots+a_m=a_0\end{cases}$ and no subset of $\{a_1,\ldots,a_m\}$ sums to $0$. Then, independent of $\{a_i\}_{i=0}^m$, $$\forall \epsilon>0,\exists \kappa >0 : \max_{0\le i\le m}(|a_i|)\le \kappa\cdot \left(\prod_{i=0}^m{\text{rad}_{(m-1)}(a_i)}\right)^{1+\epsilon}. \hspace{1cm} [\textbf{1}]$$

Corollary. The above conjecture would imply that for every $\epsilon>0$, for all but finitely many such $\{a_i\}_{i=0}^m$, $$\max_{0\le i\le m}(|a_i|)\le \left(\prod_{i=0}^m{\text{rad}_{(m-1)}(a_i)}\right)^{1+\epsilon}.$$

Lemma 1. We have that $$\forall x\in\mathbb{Z}, \forall n,k\in\mathbb{Z}^+: n\ge k\implies \text{rad}_k (x^n)=\text{rad}(x)^k.$$

Proof. Suppose $x=\pm\prod_{i=1}^{s}{p_i^{e_i}}$ as in the definition, and that $n,k\in\mathbb{Z}^+: n\ge k$. Each $e_i\ge 1$ so $ne_i\ge k$ and $$\text{rad}_k (x^n)=\prod_{i=1}^{s}{p_i^{\min(ne_i,k)}}=\prod_{i=1}^{s}{p_i^k}=\left(\prod_{i=1}^{s}{p_i}\right)^k=\text{rad}(x)^k,$$ as desired.

Proposition 1. Assuming the conjecture:

  1. For all sufficiently large $n$, there exist no triples of positive integers $a\le b< c$ such that $a^n+b^n=c^n+1$.
  2. If there are infinitely many triples of positive integers $a\le b< c$ such that $a^n+b^n=c^n+1$, then $n\le 6$.

Proof. Suppose that $n,a,b,c\in\mathbb{Z}^+$ such that $a^n+b^n-c^n=1$ with $a\le b< c$.

Then $\gcd(a^n,b^n,-c^n,1)=1$ and no subset of $\{a^n,b^n,-c^n\}$ sums to $0$. By the corollary and the lemma, for all but finitely many such triples $(a,b,c)$, $$c^n=\max(|a^n|,|b^n|,|-c^n|)\le \left(\text{rad}_2 (a^n)\cdot\text{rad}_2 (b^n)\cdot\text{rad}_2 (c^n)\right)^{1+\epsilon}= (a^2 b^2 c^2)^{1+\epsilon}<c^{6(1+\epsilon)}.$$

Fix any $\epsilon>0$. Then it is clear that for sufficiently large $n$, $c$ does not even exist and so neither does a triple.

If the existence of infinitely many solutions is assumed, a triple with $c^n<c^{6(1+\epsilon)}$ exists as there are only finitely many exceptions. Then $n<6(1+\epsilon)$, and as this holds for every $\epsilon>0$, we get $n\le 6$.

Corollary. The exact same proposition and proof holds for the equation $a^n+b^n=c^n -1$.

In order to study the equations for even $n$, we first solve $a^2+b^2=c^2\pm 1$, for each sign.

Lemma 2. The binary quadratic form $ap^2+bpq+cq^2$ is equivalent to

  1. $p^2+q^2$ if and only if $b^2-4ac=-4$.
  2. $p^2-q^2$ if and only if $b^2-4ac=4$ and $a,c$ are not both even.

Proposition 2. The integers $x,y,z$ satisfy $x^2+y^2=z^2\pm 1$, for a fixed sign the opposite of which is $\mp$, if and only if there exist integers $a_1,a_2,b_1,b_2$ such that $$\begin{cases} 1=a_1 b_2-a_2b_1\\ 2x=(a_1^2-a_2^2)\mp (b_1^2-b_2^2)\\ y=a_1 a_2\mp b_1 b_2\\ 2z=(a_1^2+a_2^2)\mp (b_1^2+b_2^2) \end{cases}.$$

This is under the assumption that if not both of $x,y$ are even, then $x$ is odd, which does not compromise generality as $x,y$ are symmetric in the equation.

Proof. Suppose $x,y,z\in\mathbb{Z}$ such that $x^2+y^2=z^2\pm 1$, for a fixed sign. Let $b=y$ and define $a,c$ as $$\begin{cases}a=z+x\\ c=z-x\end{cases}\iff \begin{cases}2x=a-c\\ 2z=a+c\end{cases}.$$

Substituting yields $$\left(\frac{a-c}{2}\right)^2+b^2=\left(\frac{a+c}{2}\right)^2\pm 1\iff b^2-ac=\pm 1.$$

Then the discriminant of the binary quadratic form $$\phi(p,q)=ap^2+2bpq+cq^2$$ is $D(\phi)=(2b)^2-4ac=4(b^2-ac)=\pm 4$. If $D(\phi)=-4$, then Lemma 2.1 can be immediately applied. If $D(\phi)=4$, then Lemma 2.2 applies. This is because at least one of $a,c$ being odd is equivalent to at least one of $z,x$ being odd. If $z$ is odd, we are done. Otherwise, one of $x,y$ must be odd and in the proposition we assumed that it is $x$ in this case.

So $ap^2+2bpq+cq^2$ is equivalent to $x^2\mp y^2$. In other words, there exist $a_1,a_2,b_1,b_2\in\mathbb{Z}$ such that \begin{align*} ap^2+2bpq+cq^2 &= (a_1 p+a_2 q)^2\mp (b_1 p+ b_2 q)^2\\ &= (a_1^2\mp b_1^2)p^2+2(a_1 a_2 \mp b_1 b_2)pq+(a_2^2\mp b_2^2)q^2. \end{align*}

Moreover, since we have integers and each form is improperly equivalent to itself, it can be forced that $$\begin{pmatrix}a_1&a_2\\ b_1& b_2\end{pmatrix}\in SL_2(\mathbb{Z})\implies\det\begin{pmatrix}a_1&a_2\\ b_1& b_2\end{pmatrix}=a_1 b_2 - a_2 b_1=1,$$ One direction of the proposition follows from comparing coefficients. The other is straightforward by substituting and expanding.

So all solutions can be generated by $SL_2(\mathbb{Z})$.

Lemma 3. We have that $a,b,c,d\in\mathbb{Z}$ satisfy

  1. $a^2+b^2=c^2+d^2$ if and only if there exist $p,q,r,s\in\mathbb{Z}$ such that $$(a,b,c,d)=(pq+rs, pr-qs, pq-rs, pr+qs).$$ This is assuming, without loss of generality, that $a,c$ have the same parity and so do $b,d$.
  2. $a^2+b^2+c^2=d^2$ if and only if there exist $p,q,r,s\in\mathbb{Z}$ such that $$(a,b,c,d)=(ps+qr, p^2-q^2+r^2-s^2, pq-rs, p^2+q^2+r^2+s^2).$$


  1. Suppose $a,b,c,d\in\mathbb{Z}$ satisfy $a^2+b^2=c^2+d^2$. Assume, without loss of generality, that $a,c$ have the same parity and so do $b,d$. Define the integers $$(2a_0, 2b_0, 2c_0, 2d_0)=(a+c, d+b, a-c, d-b).$$ so that the equation can be manipulated to $a_0 c_0= b_0 d_0$.

Since $\mathbb{Z}$ is a unique factorization domain, there exist $p,q,r,s\in\mathbb{Z}$ such that $(a_0,b_0,c_0,d_0)=(pq,pr,rs,qs)$. Then $$(a,b,c,d)=(pq+rs,pr-qs,pq-rs,pr+qs).$$

The converse holds by Fibonacci's identity $$(pq+rs)^2+(pr-qs)^2=(pq-rs)^2+(pr+qs)^2.$$

  1. Suppose $a,b,c,d\in\mathbb{Z}$ satisfy $a^2+b^2+c^2=d^2$. Rewrite the equation as $(c+ai)(c-ai)=(d+b)(d-b)$ in Gaussian integers. Since $\mathbb{Z}[i]$ is a unique factorization domain, there exist $x=p+ri$ and $y=q+si$ in $\mathbb{Z}[i]$ such that $$(c+ai,c-ai, d+b, d-b)=(xy, \bar{x}\bar{y},x\bar{x}, y\bar{y}),$$ where the bar denotes complex conjugation. Then $\begin{cases} c+ai=(pq-rs) +(ps+qr)i\\ d+b=p^2+r^2\\ d-b=q^2+s^2\end{cases}$ so $$(a,2b,c,2d)=(ps+qr, p^2-q^2+r^2-s^2, pq-rs, p^2+q^2+r^2+s^2).$$

The converse holds by Lebesgue's identity $$(2(ps+qr))^2+(p^2-q^2+r^2-s^2)^2+(2(pq-rs))^2=(p^2+q^2+r^2+s^2)^2.$$

  • 2
    $\begingroup$ Thank you so much! This is beautiful work. Now I am even more interested in this question. I will now limit my searches to $N \leq 6$. $\endgroup$ Feb 9, 2021 at 16:13
  • 1
    $\begingroup$ Great stuff! I have one question (perhaps more later): In the proof of proposition one you write $$\left(\text{rad}_2 (a^n)\cdot\text{rad}_2 (b^n)\cdot\text{rad}_2 (c^n)\right)^{1+\epsilon}= (a^2 b^2 c^2)^{1+\epsilon},$$ but I can only see that $$\left(\text{rad}_2 (a^n)\cdot\text{rad}_2 (b^n)\cdot\text{rad}_2 (c^n)\right)^{1+\epsilon}= (\text{rad}(a)^2\text{rad}(b)^2\text{rad}(c)^2)^{1+\epsilon}\leq (a^2 b^2 c^2)^{1+\epsilon}.$$ Of course this does not affect the argument at all. I'm just wondering whether I'm overlooking some fact about the factorizations of $a$, $b$ and $c$. $\endgroup$
    – Servaes
    Feb 10, 2021 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .