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

Case $a=2^d,\,d\in\Bbb N$ completed

Suppose that there is a positive integer $b$ that admits $$2^b+b^2=t^2\tag1$$ 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}\tag2$$ 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)\tag3.$$ If $b$ is odd, it cannot have a factor of $2$, forcing $$b-c-1=0\implies t-b=2\implies t=b+2\tag4$$ and substituting this into $(1)$ gives $$2^b+b^2=(b+2)^2\implies 2^b=4(b+1)\tag5$$ A calculus approach can be used by extending the domain of $b$ from $\Bbb N_{>1}$ to $\Bbb R$ and it is found that no solutions exist for odd $b$.

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}\tag6$$ for some integers $m,n,s$, and we end up with the transcendental equation $$2^{mns}=s(m^2-n^2).\tag7$$

Credits to @Servaes: Without loss of generality, let $m>n>0$ and $s>0$. If $mns\ge4$ then $$2^{mns}\geq(mns)^2\geq sm^2> s(m^2-n^2),\tag8$$ so the only solutions with even $b$ are $b=4,6$, and the first case does not yield a square. $\square$

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

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}}\tag9$$

Credits to @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\tag{10}\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\tag{11}.\end{cases}$$

Credits to @Servaes: From the first equation of $(11)$, all three factors on the RHS are powers of two, so $$\begin{cases}m+n=2^u\\m-n=2^v\tag{12}\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 of $(11)$ yields $$2^{dk}=s(m-n)(m+n)=2^{u+1}s\implies s=2^{dk-u-1}.\tag{13}$$ Substituting $(13)$ into the second equation of $(11)$ yields $$(2k)^{2^{d-1}}=2mns=2(2^{u-1}+1)(2^{u-1}-1)s=(2^{2u-2}-1)2^{dk-u}\tag{14}$$ which is impossible; if we let $k=2^w\ell$ with $\ell$ odd then this implies $$\ell^{2^{d-1}}=2^{2u-2}-1\tag{15}$$ which by Catalan's conjecture/Mihailescu's theorem is impossible if $d>1$. Note that $u>v$ hence $u\geq2$.

  • 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. For the sake of illustration, consider $a=5$.

We know that an integer can never be a square number if its last digit is $2,3,7,8$. Therefore, $5^b+b^5$ is never square when $$5+b^5\equiv2,3,7,8\pmod{10}\implies b\equiv2,3,7,8\pmod{10}$$ This method can be extended to higher values of $r$.

  • As always, PARI/GP code below

(if the conjecture is true, it should only ever print out 2 6)

 sqfun(a,b)={for(i=2,a,for(j=2,b,if(issquare(i^j+j^i)==1,print(i," ",j))));}
  • 9
    $\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 at 11:34
  • 3
    $\begingroup$ @Servaes I have proven it for odd $b$ as well. $\endgroup$ – TheSimpliFire Jul 14 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 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 at 1:40
  • $\begingroup$ This is the basic form of pythagorean triples; a primitive triple $a^2+b^2=c^2$ is of the form $$(a,b,c)=(m^2-n^2,2mn,m^2+n^2),$$ with $m$ and $n$ necessarily coprime. A general pythagorean triple is then a primitive one scaled by an integer factor $k$. $\endgroup$ – Servaes Jul 17 at 17:30

$\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 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 at 17:29
  • $\begingroup$ Thanks. Regarding the coprimality condition, Beal's conjecture may help. $\endgroup$ – TheSimpliFire Jul 15 at 18:53

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 useful quite often.

Here are three lemmas I will use without further reference:

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: A perfect power is never one less than a square.

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

Proposition 1: 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^d$ with $d>1$. If $b$ is odd then writing $$(c-b^{2^{d-1}})(c+b^{2^{d-1}})=c^2-b^a=a^b=2^{bd},$$ 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^{d-1}}=2^v-1,$$ for some positive integer $v$ because $b$ is odd. Hence by Lemma 2 either $v=1$ or $2^{d-1}=1$. Clearly $v=1$ is impossible, so $2^{d-1}=1$ and so $d=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=2e$. Then we have the following Pythagorean triple: $$c^2=a^b+b^a=(2^d)^{2e}+(2e)^{2^d}=(2^{de})^2+((2e)^{2^{d-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^{de}=k(m^2-n^2),\qquad (2e)^{2^{d-1}}=2kmn,\tag{1}$$ $$\text{or}$$ $$c=k(m^2+n^2),\qquad2^{de}=2kmn,\qquad (2e)^{2^{d-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 $$(2e)^{2^{d-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^{d-1}$-th powers. But for $d>1$ no two $d$-th powers of positive numbers differ by $2$, so $d=1$. Writing $k=2^u$ and $m=2^v$ we see that $u+v+1=e$, 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)=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^{de}=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^{de-v-2}$. Plugging this into the other equation yields $$(2e)^{2^{d-1}}=2kmn=2^{de-v-2}(2^{2v}-1),$$ and writing $e=2^wf$ with $f$ odd then implies $$f^{2^{d-1}}=2^{2v}-1,$$ which by Lemma 2 implies that $2^{d-1}=1$, and hence $d=1$. Then $e=kmn$ and if $kmn\geq4$ then $$2^{kmn}\geq(kmn)^2\geq km^2>k(m^2-n^2),$$ so $e=kmn\leq3$. Then $b\leq6$ and clearly $b=2$ and $b=4$ do not yield solutions.$\qquad\square$

Proposition 2: 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 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 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 at 9:24
  • $\begingroup$ @TheSimpliFire It follows from the fact that $m$ and $n$ are coprime. $\endgroup$ – Servaes Aug 2 at 11:10

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.