Tweeted twitter.com/StackCodeGolf/status/1089085702938288128
2 added 240 characters in body
source | link

Given a natural number n, return the n-th Leyland number.

Leyland Number

Leyland numbers are positive integers k of the form

k = x^y + y^x

Where x,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.

Details

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 82.)

Test cases

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

Given a natural number n, return the n-th Leyland number.

Leyland Number

Leyland numbers are positive integers k of the form

k = x^y + y^x

Where x,y are integers strictly greater than 1.

They are enumerated in ascending order.

Details

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 82.)

Test cases

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

Given a natural number n, return the n-th Leyland number.

Leyland Number

Leyland numbers are positive integers k of the form

k = x^y + y^x

Where x,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.

Details

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 82.)

Test cases

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

1
source | link

Leyland Numbers

Given a natural number n, return the n-th Leyland number.

Leyland Number

Leyland numbers are positive integers k of the form

k = x^y + y^x

Where x,y are integers strictly greater than 1.

They are enumerated in ascending order.

Details

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 82.)

Test cases

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