OFFSET
1,2
COMMENTS
The only integer solutions (a,b) to the equation a^b = b^a are (k,k) for k >= 0, (2,4), and (4,2). [Corrected by M. F. Hasler, Oct 15 2019]
Suppose a < b. If a^b = b^a, log(a^b) = log(b^a) so log(a)/a = log(b)/b.
Now f(x) = log(x)/x is strictly increasing at (0,e) and strictly decreasing at (e, +infinity), so if 0 < x < y < e or e < y < x then f(x) < f(y).
To have f(a) = f(b) (which means a^b = b^a), a must be in (0,e) and b in (e, +infinity). Let g(a) be the restriction of f to (0,e) and h(b) to (e, +infinity). Since g and h are monotonic, there is a natural bijection between a and b such that g(a) = h(b).
In (0,e) there are two integers: 1 and 2.
1 won't work since there are no solutions 1^b=b^1 for b>e.
2 will because 2^4 = 4^2 and since we have a bijection this is the only solution.
This is the range of A000312(n) = n^n together with { 16 }. - M. F. Hasler, Oct 15 2019
FORMULA
EXAMPLE
4 is in the list because 2^2 = 2^2;
16 is in the list because 2^4 = 4^2. This is the only term not of the form n^n.
MATHEMATICA
Union[Power @@@ Select[Tuples[Range@ 20, 2], Power @@ # == Power @@ Reverse@ # &]] (* Michael De Vlieger, Apr 17 2016 *)
PROG
(PARI) a(n)=if(n>3, n-1, 4)^(n-1) \\ M. F. Hasler, Oct 15 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Natan Arie Consigli, Apr 16 2016
EXTENSIONS
Edited by M. F. Hasler, Oct 15 2019
STATUS
approved