Squaring and Cubing

Six numbers between 3 and 30 are either squares or cubes ­ 4, 8, 9, 16, 25, 27. How many numbers between 30 and 300 are either squares or cubes? How many numbers between 30 and 3000 are either squares or cubes? Note: If a number is a square and a cube, it should be counted only once.

(Source: Adapted from Mathematics Teaching in the Middle School, Mar-Apr 1997)