# Thread: Inclusion/exclusion principle for amount of numbers

1. ## Inclusion/exclusion principle for amount of numbers

Hello, I came across this problem and I wasn't entirely sure on how to do it. Seeing if someone can give me a hand with it? Any help is greatly appreciated, thanks!

2. Originally Posted by Mahonroy
Hello, I came across this problem and I wasn't entirely sure on how to do it. Seeing if someone can give me a hand with it? Any help is greatly appreciated, thanks!

Let's call $n_2\,,\,\,n_3$ to the number of squares (cubes) less than 1,000:

$10^3=1,000\Longrightarrow n_3=10$

$31^2=961\,,\,32^2=1,024>1,000\Longrightarrow n_3=31$.

Now, just take out ONCE the repeated ones: for example, $64=4^3=8^2$, so we must erase 64 since it appears twice...

Tonio

3. Thanks for the reply! I found the answer to be 38 is this what you got?

4. Yes thats right.

An easy way to see this is all perfect squares are of the form $k^2$, all perfect cubes are of the form $k^3$ and all numbers that are both a perfect square and a perfect cube are $k^6$. Using inclusion exculsion, that means for any $N$ the number of numbers that are a perfect square or a perfect cube less than N are $\lfloor N^{\frac{1}{2}} \rfloor + \lfloor N^{\frac{1}{3}} \rfloor - \lfloor N^{\frac{1}{6}} \rfloor$