Determine the number of solutions of the equation $n^m = m^n$ 
Possible Duplicate:
$x^y = y^x$ for integers $x$ and $y$ 

Determine the number of solutions of the equation 
$n^m = m^n$ 
where both m and n are integers.
 A: This is a nice problem for a calculus class, to describe all pairs $(x,\xi)$ of positive real numbers with $x\ne\xi$ and $x^\xi=\xi^x$. From $\xi\log x=x\log\xi$ you get $(\log x)/x=(\log\xi)/\xi$, in other words, you’re looking for horizontal lines that intersect the graph of $f(x)=(\log x)/x$ twice. Since the function is defined and differentiable on $\langle0,\infty\rangle$ with a single maximum, all you need to do is spot where that maximum happens, and by differentiating, you see that it’s at $x=e$. Using the fact that $f(1)=0$, you see that for any $x$ in $\langle1,e\rangle$, there’s a unique $\xi>e$ for which $x^\xi=\xi^x$. And of course you see that there’s only one integer in the open interval $\langle1,e\rangle$.
A: I remember only the result, but not the proof (anyway, probably not too hard):
Either $n=m$ or $\{n,m\}=\{2,4\}$.
A: Well, there are countably infinitely many, yes? There are (after all) only that many integer pairs $(m,n)$, so certainly no more than that will be solutions to the equation. On the other hand, any pair $(m,m)$ will be a solution, and there are countably infinitely many of those.
A: Hint:
Since $m^n=n^m$, take logs and separate the variables:
$$
\frac{\log(m)}{m}=\frac{\log(n)}{n}
$$
This suggests considering the function $f(x)=\frac{\log(x)}{x}$.
$\hspace{2cm}$
Another Approach:
Start by comparing $n^{n+1}$ vs $(n+1)^n$. Divide both by $n^n$, to get $n$ vs $\left(1+\frac1n\right)^n$. We can use the binomial theorem to get
$$
\begin{align}
\left(1+\frac1n\right)^n
&=\sum_{k=0}^\infty\binom{n}{k}\frac1{n^k}\\
&=\sum_{k=0}^\infty\frac1{k!}\frac{n}{n}\frac{n-1}{n}\cdots\frac{n-k+1}{n}\\
&<\sum_{k=0}^\infty\frac1{k!}\\
&<1+\sum_{k=1}^\infty\frac1{2^{k-1}}\\
&=3
\end{align}
$$
Thus, for $n\ge3$, we have
$$
n\ge3>\left(1+\frac1n\right)^n
$$
Multiplying both sides by $n^n$ yields that for $n\ge3$
$$
n^{n+1}>(n+1)^n
$$
Taking the $n(n+1)$ root of both sides gives
$$
n^{1/n}>(n+1)^{1/(n+1)}
$$
So we have determined that $n^{1/n}$ is monotonically decreasing for $n\ge3$. What does that say about $m^n$ and $n^m$ when $n>m\ge3$?
Simpler Proof by Induction
I just noted that $n^{n+1}>(n+1)^n$ for $n\ge3$ can be also proven pretty simply by induction.
Note that $3^4=81>64=4^3$.
Suppose that $n^{n+1}>(n+1)^n$. Divide through by $n^n$ to get
$$
n>\left(1+\frac1n\right)^n
$$
Multiply through by $1+\frac1n$ to get
$$
n+1>\left(1+\frac1n\right)^{n+1}
$$
Since $1+\frac1n>1+\frac1{n+1}$ we get
$$
n+1>\left(1+\frac1{n+1}\right)^{n+1}
$$
Multiply through by $(n+1)^{n+1}$ to get
$$
(n+1)^{n+2}>(n+2)^{n+1}
$$
This finishes the induction.
A: Hint:  it might be that $n$ and $m$ are powers of a prime.  They would clearly need to be powers of the same prime.  Define $n=p^a, m=p^b$ then apply the laws of exponents.  Otherwise, they might be a product of primes.  Again, they need to be products of the same primes.  Again, use the laws of exponents to rule it out.
