Combinatorics – Counting Numbers Between 1 and 10000 Not Squared or Cubed

combinatoricsnatural numbers

Simple question.

How many numbers between 1 and 10000 can't be written as $n^2$ or $n^3$ when $n \in \mathbb N$?

I know the way to solve this is with inclusion-exclusion. but for that I need to find the cardinality of these sets:

1) The set of all numbers between 1 to 10000 that can be written as $n^2$

2) The set of all numbers between 1 to 10000 that can be written as $n^3$

3) The set of all numbers between 1 to 10000 that can be written as $n^6$

How do I find out how many elements are in those sets?

Best Answer

Let $m_2$ be greatest such that $m_2^2 \le 10000$, then there are $m_2$ squares between $1$ and $10000$, because if we list all the squares we have $$\underbrace{1^2,\ 2^2,\ \dots, (m_2-1)^2,\ m_2^2}_{\le 10000},\ \underbrace{(m_2+1)^2,\ (m_2+2)^2,\ \cdots}_{>10000}$$ Define $m_3$ and $m_6$ similarly, and then apply inclusion-exclusion.