Find the number of integers from 1 to 1 million that are not perfect squares or perfect cubes.
The square root of 1,000,000 is 1000; therefore, there will be 1000 perfect squares:
12 = 1
22 = 4
32 = 9
...
9982 = 996,004
9992 = 998,001
10002 = 1,000,000
Now, we have to cross-check that with a list of perfect cubes.
Since the cube root of 1,000,000 is 100, there will be 100 numbers on this list.
13 = 1 Cross this one off
23 = 8
33 = 27
43 = 64 Cross this one off
...
983 = 941,192
993 = 970,299
1003 = 1,000,000 Cross this one off
So, there will be a total of 1000 from the list of perfect squares plus all those on the list of perfect cubes that
aren't crossed off.
Then, subtract that total from 1,000,000.