Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|cite|improve this question

marked as duplicate by Ross Millikan, Cameron Buie, Argon, Steven Stadnicki, Henry Sep 19 '12 at 23:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

See $x^y = y^x$ for integers $x$ and $y$ - and maybe also some questions linked there. – Martin Sleziak Sep 19 '12 at 17:49
up vote 12 down vote accepted


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}$enter image description here

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.

share|cite|improve this answer
Whoops, you got into print before me. – Lubin Sep 19 '12 at 18:08

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

share|cite|improve this answer

I remember only the result, but not the proof (anyway, probably not too hard):

Either $n=m$ or $\{n,m\}=\{2,4\}$.

share|cite|improve this answer
Well, so the number is infinite already by these examples. – Hagen von Eitzen Sep 19 '12 at 17:23

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.

share|cite|improve this answer
Right you are. The interesting solutions are those off the diagonal, though. – Lubin Sep 19 '12 at 17:50

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.

share|cite|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.