Ad
  • Custom User Avatar

    OK, you're missing 32 = 25. b is not limited to 3. You could limit yourself to prime values of b, but you have time to do all of them; that's probably easier. Also, filtering an array of size n is never going to work for n up to 1010. You'll need a major redesign.

  • Custom User Avatar

    If you post which numbers you think are representable as powers, I can also look into it.

  • Custom User Avatar

    I get [ 4, 8, 9, 16, 25, 27, 32, 36, 49, 64, 81, 100 ]. That's 12 of 'em, so 89 can't be correct.

    You might also get an off-by-one error by counting powers up to but not including n, and subtracting that from n. But that would be silly.

  • Custom User Avatar

    I think you're wrong.

    What numbers from the first 100 do you think are representable as ab ?

    Note that there are fourth, fifth and even a sixth power below 100.