Conjecture: $100$ is the only square number of the form $a^b+b^a$ for integers $b>a>1$.

In other words, $(a,b)=(2,6)$ is the only solution. Can we prove/disprove this?


  • The solution mentioned should not come as a surprise, since $2^6+6^2=8^2+6^2=10^2$ is a (non-primitive) Pythagorean triple. It is possible to show that $2^b+b^2$ has no other solutions. See Remark 1.

  • In the general case where $a$ is a power of $2$; that is, $a=2^d$ for some positive integer $d$, a similar approach can be followed. See Remark 2.

  • We can eliminate some values of $b$ when $a=5^r,6^r$, since no matter the value of $r$, we have $a\equiv5,6\pmod{10}$ respectively.

  • PARI/GP code: If the conjecture is true it should only ever print 2 6.

    sqfun(a,b)={for(i=2,a,for(j=2,b,if(issquare(i^j+j^i)==1,print(i," ",j))));}

Remark 1: Suppose that there is a positive integer $b$ that admits $2^b+b^2=t^2$ for some integer $t$. Then we can write the equation as $$2^b=(t+b)(t-b)\implies\begin{cases}t+b=2^c\\t-b=2^{b-c}\end{cases}$$ for some positive integer $c>\dfrac b2$. Subtracting the two equations yields $$2b=2^c-2^{b-c}\implies b=2^{b-c-1}(2^{2c-b}-1).$$ If $b$ is odd, it cannot have a factor of $2$, forcing $b-c-1=0\implies t=b+2$ and substituting gives $2^b+b^2=(b+2)^2$, or $2^b=4(b+1)$. No solutions exist.

If $b$ is even, then $b=2k$ for some positive integer $k$, so we must have $$\begin{cases}2^k=s(m^2-n^2)\\2k=2mns\end{cases}$$ for some integers $m,n,s$, so that $2^{mns}=s(m^2-n^2)$. Without loss of generality, let $m>n>0$ and $s>0$. [Servaes: If $mns\ge4$ then $2^{mns}\geq(mns)^2\geq sm^2> s(m^2-n^2)$, so the only solutions with even $b$ are $b=4,6$, and the first case does not yield a square.]

Remark 2: If $b$ is odd, it boils down to the equation $$2^{db}=4\left(b^{2^{d-1}}+1\right)\implies 2^{db-2}-1=b^{2^{d-1}}.$$ [Haran: For $db-2>1$, the LHS is congruent to $3\pmod4$, and since the RHS is a square for $d>1$, we reach a contradiction unless \begin{cases}d=1\implies a=2\quad\text{case covered above}\\db-2=1\implies1=b^{2^{d-1}}\implies 2^{d-1}=0\end{cases} which is impossible.]

If $b$ is even, then $b=2k$ for some positive integer $k$, and the Pythagorean triplet forces $$\begin{cases}2^{dk}=s(m^2-n^2)\\(2k)^{2^{d-1}}=2mns.\end{cases}$$ [Servaes: From the first equation, all three factors on the RHS are powers of two, so $$\begin{cases}m+n=2^u\\m-n=2^v\end{cases}\implies\begin{cases}m=2^{v-1}(2^{u-v}+1)\\n=2^{v-1}(2^{u-v}-1)\end{cases}$$ with $u>v>0$. Since $m$ and $n$ are coprime, we have $v=1$. Plugging this into the first equation yields $$2^{dk}=s(m-n)(m+n)=2^{u+1}s\implies s=2^{dk-u-1}.$$ Substituting this into the second equation yields $$(2k)^{2^{d-1}}=2mns=2(2^{u-1}+1)(2^{u-1}-1)s=(2^{2u-2}-1)2^{dk-u}$$ which is impossible; if we let $k=2^w\ell$ with $\ell$ odd then this implies $\ell^{2^{d-1}}=2^{2u-2}-1$ which by Catalan's conjecture/Mihailescu's theorem is impossible if $d>1$. Note that $u>v$ hence $u\geq2$.]

  • 10
    $\begingroup$ Since $b=2k=2mns>2$ the transcendental equation $$2^{mns}=s(m^2-n^2),$$ shows that without loss of generality $m>n>0$ and $s>0$. If $mns\geq4$ then $$2^{mns}\geq(mns)^2\geq sm^2> s(m^2-n^2),$$ so the only solutions with $b$ even must have $b\in\{4,6\}$, and $b=4$ does not yield a square. $\endgroup$
    – Servaes
    Jul 14, 2019 at 11:34
  • 3
    $\begingroup$ @Servaes I have proven it for odd $b$ as well. $\endgroup$
    – TheSimpliFire
    Jul 14, 2019 at 13:28
  • 2
    $\begingroup$ For the case $a=2^d$ and $b=2k$ you have found $$2^{dk}=s(m^2-n^2)=s(m-n)(m+n),$$ so all three factors on the RHS are powers of two, so $$m+n=2^u\qquad\text{and}\qquad m-n=2^v,$$ for nonnegative integers $u$ and $v$, and clearly $u>v>0$. Then $$m=\frac{(m+n)+(m-n)}2=\frac{2^u+2^v}2=2^{v-1}(2^{u-v}+1),$$ $$n=\frac{(m+n)-(m-n)}2=\frac{2^u-2^v}2=2^{v-1}(2^{u-v}-1),$$ but of course $m$ and $n$ are coprime, so $v=1$. (Continued... $\endgroup$
    – Servaes
    Jul 16, 2019 at 1:40
  • 2
    $\begingroup$ ...Continued) Plugging this into the original equation yields $$2^{dk}=s(m-n)(m+n)=2^{u+1}s,$$ or equivalently $s=2^{dk-u-1}$. Then plugging this into your other equation yields $$(2k)^{2^{d-1}}=2mns=2(2^{u-1}+1)(2^{u-1}-1)s=(2^{2u-2}-1)2^{dk-u},$$ which is impossible; if $k=2^w\ell$ with $\ell$ odd then this implies $$\ell^{2^{d-1}}=2^{2u-2}-1,$$ which by Catalan's conjecture/Mihailescu's theorem is impossible if $d>1$. Note that $u>v$ hence $u\geq2$. $\endgroup$
    – Servaes
    Jul 16, 2019 at 1:40

2 Answers 2


$\newcommand{\eps}{\varepsilon}$ $\newcommand{\rad}{\mathrm{rad}}$

At least, under the abc conjecture, there can be only finitely many pairs $(a,b)$ with $b>a>1$ coprime such that $a^b+b^a$ is a square.

As a reminder, the conjecture says that to any $\eps>0$ there corresponds some $K_\eps>0$ such that whenever $u,v$, and $w$ are coprime positive integers with $u+v=w$, one has $\rad(uvw)>K_\eps w^{1-\eps}$. Here $\rad(z)$ is the product of all primes dividing $z$ (thus, for instance, $\rad(8)=2$, $\rad(9)=3$, $\rad(10)=10$, $\rad(11)=11$, and $\rad(12)=6$).

Suppose now that $a^b+b^a=c^2$ with coprime integers $b>a\ge 3$ and $c>0$ (the case $a=2$ is resolved above). Applying the abc conjecture with $u=a^b$, $v=b^a$, $w=c^2$, and $\eps=0.05$, and making the key observation $\rad(a^bb^ac^2)\le abc$, we conclude that $$ Kc^{2\cdot 0.95} < abc $$ with an absolute constant $K>0$. At the same time, we have $c^2>a^b$ and $c^2>b^a$, implying $a<c^{2/b}$ and $b<c^{2/a}$, respectively. Consequently, $$ Kc^{1.9} < c^{(2/b)+(2/a)+1}, $$ showing that either $\frac1b+\frac1a>0.4$, or $Kc^{0.1}<1$. Clearly, there are only finitely many values of $c$ satisfying the latter condition, and to each value corresponds finitely many pairs $(a,b)$. On the other hand, since $\frac1b+\frac13\ge\frac1b+\frac1a>0.4$ implies $b<15$, there are only finitely many pairs $(a,b)$ satisfying the former condition. Thus, the total number of exceptional pairs $(a,b)$ is also finite.

  • 1
    $\begingroup$ You left out the relative primality condition in the description and use of the $abc$ conjecture. $\endgroup$
    – KCd
    Jul 15, 2019 at 17:06
  • $\begingroup$ @KCd: thanks for bringing this to my attention, I have edited the answer (and will check whether this is a smarter way to deal with it). $\endgroup$
    – W-t-P
    Jul 15, 2019 at 17:29

(21-03-2020) Update: As no unconditional answer has yet been given, I will include a few more conditions that any solution must satisfy. The results used are rather advanced, so I will only include references, not proofs.

Lemma 5: Let $a$ and $b$ be positive integers such that $a^b+b^a$ is a perfect square. Then $\gcd(a,b)\leq3$.

Proof. Such a pair of positive integers yields a nontrivial integral solution to $$x^d+y^d=z^2,\tag{3}$$ where $d:=\gcd(a,b)$. This implies $d\leq3$ by this paper${}^1$.$\qquad\square$

Proposition 6: Let $a$ and $b$ be positive integers such that $a^b+b^a$ is a perfect square. Then $\gcd(a,b)\leq2$.

Proof. By the preceding lemma it suffices to show that $\gcd(a,b)=3$ is impossible. If $\gcd(a,b)=3$ then $a^{\tfrac b3}$ and $b^{\tfrac a3}$ are integers satisfying $$\Big(a^{\tfrac b3}\Big)^3+\Big(b^{\tfrac a3}\Big)^3=z^2,$$ for some integer $z$, which means that, after swapping $a$ and $b$ if necessary, either $$a^{\tfrac b3}=\frac{x(x^3-8y^3)}{w^2}z^2 \qquad\text{ and }\qquad b^{\tfrac a3}=\frac{4y(x^3+y^3)}{w^2}z^2,$$ for integers $x$, $y$ and $z$ with $x$ odd and $x$ and $y$ coprime, and $w:=\gcd(3,x+y)$, or $$a^{\tfrac b3}=\frac{x^4+6x^2y^2-3y^4}{w^2}z^2 \qquad\text{ and }\qquad b^{\tfrac a3}=\frac{3y^4+6x^2y^2-x^4}{w^2}z^2,$$ for $x$, $y$ and $z$ with $x$ and $y$ coprime and $x$ coprime to $3$, and $w=\gcd(2,x+1,y+1)$. These complete parametrizations of the integral solutions to $(3)$ when $d=3$ are taken from section 7.2 of this article${}^2$.

For the second parametrization, because $x$ is coprime to $3$ we see that $$\nu_3\Big(a^{\tfrac b3}\Big)=\nu_3(z^2) \qquad\text{ and }\qquad \nu_3\Big(b^{\tfrac a3}\Big)=\nu_3(z^2),$$ where $\nu_p(t)$ denotes largest integer $k$ such that $p^k$ divides $t$. It follows that $a\nu_3(b)=b\nu_3(a)$, and from $\gcd(a,b)=3$ it follows that either $\nu_3(a)=1$ or $\nu_3(b)=1$, so either $a$ divides $b$ or $b$ divides $a$, respectively. This means either $a=3$ or $b=3$.

If $a=3$ then the identity $$3^{\tfrac b3}=a^{\tfrac b3}=\frac{x^4+6x^2y^2-3y^4}{w^2}z^2,$$ shows that $z^2=3^{\tfrac b3}$. The parametrization for $b^{\tfrac a3}$ then shows that $3^{\tfrac b3}$ divides $b^{\tfrac a3}=b$, which quickly implies $b=3$. But $3^3+3^3=54$ is not a perfect square; a contradiction. If $b=3$ a similar argument shows that then $a=3$, and this shows that the second parametrization yields no solutions to our original problem.

For the first parametrization, note that $b$ is even and hence $a^{\tfrac b3}$ is a perfect square, hence so is $$w^2z^{-2}a^{\tfrac b3}=x(x^3-8y^3)=x^4-8xy^3.$$ This means there is some integer $c$ such that $x^4-8xy^3=(x^2-2c)^2$ and so $$cx^2+2y^3x-c^2=0.$$ In particular the discriminant $\Delta$ of this quadratic polynomial in $x$ is a perfect square, say $\Delta=(2e)^2$, where $$4e^2=\Delta=(2y^3)^2-4c(-c)^2=4(y^6+c^3).$$ It is a classical result that then for some nonnegative integer $k$ we have $$(|e|,c,|y|)=(3k^3,2k^2,k).$$ Plugging this in and solving the quadratic equation for $x$ yields $x\in\{\pm k,\pm2k\}$ where $y=\pm k$. Because $x$ and $y$ are coprime it follows that $k=1$, so $y=\pm1$ and $x\in\{\pm1,\pm2\}$. Then for $a^{\tfrac b3}$ to be a perfect square we must have $\{x,y\}=\{1,-1\}$, but then $b=0$, a contradiction. This shows that the second parametrization also yields no solutions to our original problem. In conclusion $\gcd(a,b)=3$ is impossible. $\quad\square$.

A small step towards a complete proof of the original problem would be to show that any solution other than $\{a,b\}=\{2,6\}$ must have $a$ and $b$ coprime, which seems likely. So for now, I propose the following conjecture:

Conjecture 7: Let $a$ and $b$ be positive integers such that $a^b+b^a$ is a perfect square and $\gcd(a,b)=2$. Then $\{a,b\}=\{2,6\}$.

Of course such solutions yield Pythagorean triples, for which the parametrization is well known. Perhaps arguments similar to those of Proposition 6 can be used here. I hope to give another update resolving this conjecture soon.


  1. H. Darmon and L. Merel, Winding quotients and some variants of Fermat’s last theorem, J.Reine Angew. Math. 490 (1997), 81–100.
  2. H. Darmon, A. Granville, On the equations $x^p+y^q=z^r$ and $z^m=f(x, y)$, Bulletin of the London Math. Society, no 129, 27 part 6, November 1995, pp. 513–544.

Original answer:

I'll collect a few partial results here. Let $a$, $b$ and $c$ be positive integers with $a,b>1$ such that $$a^b+b^a=c^2,$$ and let $d=\gcd(a,b)$. First two lemmas that are repeatedly useful.

Lemma 1: If $m$ and $n$ are positive integers with $m>n$ and not both even, such that $m+n$ and $m-n$ are both powers of $2$, then $m=2^k+1$ and $n=2^k-1$ for some positive integer $k$.

Proof. If $m+n=2^u$ and $m-n=2^v$ then $$m=\frac{(m+n)+(m-n)}2=\frac{2^u+2^v}2=2^{v-1}(2^{u-v}+1),$$ $$n=\frac{(m+n)-(m-n)}2=\frac{2^u-2^v}2=2^{v-1}(2^{u-v}-1),$$ and hence $v=1$ because one of $m$ and $n$ is odd. Then $k=u-v$.$\qquad\square$

Lemma 2: The only perfect power that is one less than a square is $8$.

Proof. There are fairly elementary proofs, but it also follows from Mihailescu’s theorem.$\qquad\square$

Proposition 3: If $a$ is a power of $2$ then $(a,b)=(2,6)$.

Most of this was proved in the original question by TheSimpliFire and Haran.

Proof. Let $a=2^e$. If $b$ is odd then writing $$(c-b^{2^{e-1}})(c+b^{2^{e-1}})=c^2-b^a=a^b=2^{be},$$ shows that both factors on the left hand side are powers of $2$. Then by Lemma 1 we have $c=2^v+1$ and $$b^{2^{e-1}}=2^v-1,$$ for some positive integer $v$ because $b$ is odd. Hence by Lemma 2 either $v=1$ or $2^{e-1}=1$. Clearly $v=1$ is impossible, so $2^{e-1}=1$ and so $e=1$. Then comparing exponents shows that $b=v+2$ and so $$v+2=b=2^v-1,$$ which is easily seen to have no integral solutions. Hence $b$ is even, say $b=2f$. Then we have the following Pythagorean triple: $$c^2=a^b+b^a=(2^e)^{2f}+(2f)^{2^e}=(2^{ef})^2+((2f)^{2^{e-1}})^2.$$ Then there exist positive integers $k$, $m$ and $n$ with $m>n$ and $\gcd(m,n)=1$ such that either $$c=k(m^2+n^2),\qquad2^{ef}=k(m^2-n^2),\qquad (2f)^{2^{e-1}}=2kmn,\tag{1}$$ $$\text{or}$$ $$c=k(m^2+n^2),\qquad2^{ef}=2kmn,\qquad (2f)^{2^{e-1}}=k(m^2-n^2).\tag{2}$$ In case the triple is of the form $(2)$, the middle identity shows that $k$, $m$ and $n$ are all powers of $2$, so in particular $n=1$ because $m$ and $n$ are coprime and $m>n$. Then the latter identity shows that $$(2f)^{2^{e-1}}=k(m^2-1)=k(m-1)(m+1),$$ where the factors $m-1$ and $m+1$ are odd and $k$ is a power of $2$, so both $m-1$ and $m+1$ are $2^{e-1}$-th powers. But for $e>1$ no two $2^{e-1}$-th powers of positive numbers differ by $2$, so $e=1$. Writing $k=2^u$ and $m=2^v$ we see that $u+v+1=f$, where $v\geq1$ because $m>n$. By comparing powers in the above we find that $$u+v+1=2^{u-1}(2^{2v}-1)=2^{u-1}(2^v-1)(2^v+1).$$ Of course $2^v+1>2$, so $2^{u-1}=1$ as otherwise $$2^{u-1}(2^v+1)>2^{u-1}+2^v+1\geq u+v+1,$$ a contradiction. Hence $u=1$ and $2^{2v}-1=v+2$, so also $v=1$. This yields the solution $(a,b)=(2,6)$.

On the other hand, if the Pythagorean triple is of the form $(1)$ then $k$, $m-n$ and $m+n$ are powers of $2$ because $$2^{ef}=k(m^2-n^2)=k(m-n)(m+n).$$ Because $m$ and $n$ are not both even, by Lemma 1 there exists a positive integer $v$ such that $m=2^v+1$ and $n=2^v-1$, and so the above shows that $k=2^{ef-v-2}$. Plugging this into the other equation yields $$(2f)^{2^{e-1}}=2kmn=2^{ef-v-1}(2^{2v}-1),$$ and writing $f=2^wg$ with $g$ odd then implies $$g^{2^{e-1}}=2^{2v}-1,$$ which by Lemma 2 implies that $2^{e-1}=1$, and hence $e=1$. Then $f=kmn$ and if $kmn\geq4$ then $$2^{kmn}\geq(kmn)^2\geq km^2>k(m^2-n^2),$$ so $f=kmn\leq3$. Then $b\leq6$ and clearly $b=2$ and $b=4$ do not yield solutions.$\qquad\square$

Proposition 4: If $d$ is even then $d=2$.

Proof. Suppose $d=2e$ and let $a=2eA$ and $b=2eB$. Then $e$ is odd as otherwise $c^2$ is the sum of two fourth powers, which is well known to be impossible by a classical result by Fermat. Now $$c^2=a^b+b^a=(a^{eB})^2+(b^{eA})^2,$$ is a pythagorean triple and hence there exist positive integers $k$, $m$ and $n$ with $m>n$ and $\gcd(m,n)=1$ such that $$a^{eB}=k(m^2-n^2),\qquad b^{eA}=2kmn,\qquad c=k(m^2+n^2),$$ where we can exchange the roles of $a$ and $b$ if necessary. It is clear that $$k=\gcd(a^{eB},b^{eA})=\gcd((dA)^B,(dB)^A)^e=d^{e\ell},$$ where $\ell\geq\min\{A,B\}$. In particular $k$ is an $e$-th power, and hence the factorizations $$(a^B)^e=k(m^2-n^2)=k(m-n)(m+n) \qquad\text{ and }\qquad (b^A)^e=2kmn,$$ show that, up to powers of $2$, the factors $m$, $n$, $m+n$ and $m-n$ are also $e$-th powers. That is to say, $$m=2^tp^e,\qquad n=2^uq^e,\qquad m+n=2^vr^e,\qquad m-n=2^ws^e,$$ for odd positive integers $p$, $q$, $r$ and $s$, and nonnegative integers $t$, $u$, $v$ and $w$, and $t+u+1\equiv v+w\equiv0\pmod{e}$. Then $$m=\frac{(m+n)+(m-n)}{2}=\frac{2^vr^e+2^ws^e}{2}=2^{v-1}r^e+2^{w-1}s^e,$$ $$n=\frac{(m+n)-(m-n)}{2}=\frac{2^vr^e-2^ws^e}{2}=2^{v-1}r^e-2^{w-1}s^e,$$ and at least one of $m$ and $n$ is odd, so either $v=1$ or $w=1$ (but not both) or $v=w=0$.

If either $v=1$ or $w=1$ (but not both) then $m$ and $n$ are both odd, so $t=u=0$ and hence $e=1$.

If $v=w=0$ then still either $t=0$ or $u=0$ because $m$ or $n$ is odd. If $u=0$ then $e\mid t+1$ and $$2^{t+1}p^e=2m=(m+n)+(m-n)=r^e+s^e,$$ and so it follows from Fermats last theorem that $e=1$. The same holds if $t=0$.$\qquad\square$

  • $\begingroup$ In the proof of Proposition 2, you write: Then $e$ is odd as otherwise $c^2$ is the sum of two fourth powers, which is well known to be impossible by a classical result by Fermat. Fermat theorem does not seem to apply as it refers to primitive solutions only, while $(2eA)^{eB/2}$ and $(2eB)^{eA/2}$ are not coprime, correct? $\endgroup$
    – W-t-P
    Jul 17, 2019 at 18:56
  • 1
    $\begingroup$ @W-t-P I'm referring to Fermat's proof that the diophantine equation $$x^4+y^4=z^2,$$ has no solutions in the positive integers. There is no need to require $x$, $y$ and $z$ to be coprime; in fact if they are not, say $x=du$ and $y=dv$ with $\gcd(u,v)=1$, then $$z^2=x^4+y^4=(du)^4+(dv)^4=d^4(u^4+v^4),$$ and so $z=d^2w$ for some integer $w$ and $$u^4+v^4=w^2,$$ is a primitive solution. So if no primitive solutions exist, no (nonzero) solutions exist at all. $\endgroup$
    – Servaes
    Jul 17, 2019 at 21:06
  • $\begingroup$ You write that $2mn=\left(\frac{b^A}{d^\ell}\right)^e$ implies that $m,n$ are $e$-th powers up to power of $2$. However, how about $2\cdot(2^1\cdot3^1)\cdot(2^1\cdot3^2)=6^3$, for example? Elaboration on this would be great. $\endgroup$
    – TheSimpliFire
    Aug 2, 2019 at 9:24
  • $\begingroup$ @TheSimpliFire It follows from the fact that $m$ and $n$ are coprime. $\endgroup$
    – Servaes
    Aug 2, 2019 at 11:10
  • 2
    $\begingroup$ This is very nice; maybe even publishable. $\endgroup$
    – TheSimpliFire
    Mar 22, 2020 at 13:48

You must log in to answer this question.

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