How many positive integers less than 2000 are of the form \(x^n\) for some positive integer \(x\) and \(n\ge 2?\)
a=2; b=2;c= a^b; if(c<=2000, goto4, goto5);printc,", ",; a++;if(a<45, goto2, 0);a=2;b++;if(b<45, goto2,0)
4 8 9 16 25 27 32 36 49 64 81 100 121 125 128 144 169 196 216 225 243 256 289 324 343 361 400 441 484 512 529 576 625 676 729 784 841 900 961 1000 1024 1089 1156 1225 1296 1331 1369 1444 1521 1600 1681 1728 1764 1849 1936 >>Total = 58
Squares: there are 44 of them (44*44=1936 but 45*45=2025)
Cubes: there are 12 of them (up to 12*12*12=1728) but exclude 1^3, 4^3, and 9^3 as those are also squares, so just 9 unique ones.
Fourth powers (and all non-prime powers)—are included under lower-ranked exponents
Fifth powers: 4 of them (up to 4*4*4*4*4=1024, but exclude 1^5 and 4^5 as they are also squares, so just 2 unique ones
Seventh powers: Just 1 unique one: 2^7=128.
Once we get up to 11th powers or higher, the lowest unique example is 2^11=2048 which is too big.
So in total, there are 44+9+2+1=56 such numbers up to 2000.