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

I was told by one of my friends that any given positive integer can be expressed in the form of $x^y + y^x$ where x & y are integers.

For example: 17 = $2^3+3^2$

Surprisingly,this could be done for any number. Now he gave me some another number (like 23421) and asked me to find out the values of x & y.

I racked my brain but couldn't get it. Can any one please explain, how is this possible and how to get the values of x & y

share|cite|improve this question
$23420^1+1^{23420}$. The example was designed to mislead. – André Nicolas Sep 9 '11 at 9:53
@André : turn your comment into an answer! You Rock! – Arjang Sep 9 '11 at 10:36
@André Nicolas: Yeah! I figured that out just 10min after I posted this question. It made me feel stupid. But I didn't delete this questions because, I was hoping some one would prove that it is not possible for any value other than 1 – claws Sep 12 '11 at 4:38
@claws: As the $2^3+3^2$ example shows, some positive integers can be expressed non-trivially as $x^y+y^x$. But such $n$ are "rare." It might be interesting to know whether some $n$ can be expressed in more than two ways. – André Nicolas Sep 12 '11 at 4:52
Wow, a surprisingly easy problem with a surprisingly trivial answer, right? – Simple Art Feb 5 at 0:38
up vote 10 down vote accepted

It is a joke problem ("spoiler" below).

$$ $$

The joke is that if $x > 1$ and $y > 1$ the set of integers of the form $x^y + y^x$ has density zero, so that most numbers are not expressible, while if $x=1$ is allowed the problem is trivial. Hence the misdirection.

share|cite|improve this answer
"has density zero, so that most numbers are not expressible"?? I didn't get this. What do you mean by "has density zero"? – claws Sep 11 '11 at 16:25
@claws: it means that of the integers from 1 to $n$ for large enough $n$, nearly 100 percent are non-expressible, and in the limit where $n$ is "infinitely large" or "tends to infinity", the fraction of non-expressibles is 100 percent. ( ). The number of expressible integers less than $n$ is approximately $\sqrt{n}$, so that the density of expressibles in [1,n] is about $1/\sqrt{n}$, which approaches zero as $n$ increases. – zyx Sep 11 '11 at 17:58
$n=(n-1)^{1} + 1^{n-1}$, for those (elementary folks) like myself who would like it spelled out. – raxacoricofallapatorius Sep 17 '11 at 2:48
Is there a solution that assumes x&y >1? – Pureferret Oct 2 '12 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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