Structure of integer pairs which commute under exponentiation In the natural numbers, exponentiation is defined as a non-commutative operation, but there are some pairs $\{a,b\}$ for which $a^b=b^a$, like for example, $\{2,4\}$. Is there any mathematical structure to which exactly pairs these are, like for example, do they form a sequence?
 A: Let's look first for real numbers $a>b>0$ with $a^b=b^a$.
Write $a=tb$ with $t>1$. Then the equation becomes
$$(tb)^b=b^{tb}$$
which is equivalent to
$$tb=b^t$$
and so to
$$t=b^{t-1}$$
and finally to
$$b=t^{1/(t-1)}.$$
So
$$(a,b)=(t^{t/(t-1)},t^{1/(t-1)})$$
for $t>1$ is the parametric solution of $a^b=b^a$ with $a>b>0$.
Next question: when are $a$ and $b$ rational? Clearly $t=a/b$ must be rational.
Write $t=r/s$ in least terms. Then
$$b=\left(\frac rs\right)^{s/(r-s)}.$$
That's certainly rational if $r-s=1$. But if $r-s\ge2$ it can only be rational
when $r$ and $s$ are both perfect $(r-s)$-th powers. But the least difference
of positive integer $k$-th powers is $2^k-1$ which is $>k$ for $k\ge2$. So the
rational solutions have $t=r/s=(s+1)/s$ leading to
$$(a,b)=((s+1)^{s+1}/s^{s+1},(s+1)^s/s^s)$$
where $s$ is a positive integer.
Final question: when are $a$ and $b$ both integers. When $s=1$, $(a,b)=(4,2)$.
If $s>1$, $b=(s+1)^s/s^s$ has a denominator of $s^s$ and isn't an integer.
$(a,b)=(4,2)$ is the only integer solution.
