Given a natural number \$n\$, return the \$n\$-th Leyland number.
Leyland numbers are positive integers \$k\$ of the form
$$k = x^y + y^x$$
Where \$x\$ and \$y\$ are integers strictly greater than 1.
They are enumerated in ascending order.
EDIT: @DigitalTrauma suggested I include following "definition":
Imagine we throw \$x^y+y^x\$ in a bag for all possible values of \$x\$ and \$y\$, and avoid throwing in duplicates. Then we sort that bag. The sorted bag is our sequence.
You may use 0 or 1 based indexing, whatever suits you best.
Your program must be able to output at least all Leyland numbers less than the maximum of signed 32-bit integers. (The last Leyland number below this limit is
1996813914, at index
The first few terms are following:
8, 17, 32, 54, 57, 100, 145, 177, 320, 368, 512, 593, 945, 1124
A076980 in OEIS, except for the first entry. Note that because of that additional first entry, the indices on OEIS are shifted by one.
More can be found in the OEIS b-file