Consider all integer combinations of for and :
,
,
,
,
,
,
,
,
,
,
,
,
If they are then placed in numerical order, with any repeats removed, we get the following sequence of 15 distinct terms:
4, 8, 9, 16, 25, 27, 32, 64, 81, 125, 243, 256, 625, 1024, 3125
How many distinct terms are in the sequence generated by for and ?
469 ms
The tricky part of this problem was getting JavaScript to handle 𝔹𝕀𝔾®
numbers. Thankfully the BigInt is here and it made things a bit easier. I made
two helper functions to put my numbers in an array and another to check if my
numbers were in the array.
I run two nested for loops and compute every power, checking and inserting as
I go.
103,541