Finding the nth non square free number We all know what squarefree numbers are. I was more interested in checking an efficient way to find nth non square free number.
Let $S(n)$ be the count of squarefree numbers less than or equal to $n$. Note that each integer $n$ has a unique "squarefree decomposition" $n = a^2b$ where $b$ is squarefree. 

One approach is to start with $n$ and then remove the counts we don't want, i.e. anything with $a&gt;1$. Using inclusion-exclusion, this suggests a recursion:

$$S(n) = n - \sum_{a=2}^{\lfloor\sqrt{n}\rfloor} S\left(\left\lfloor\frac{n}{a^2}\right\rfloor\right)$$

This isn't the most efficient approach as-stated, but it's a good starting point for additional insights and optimizations. Can you take it from here?
The $n$-th non square integer is given by the formula $n + [ \sqrt{n} + 0.5],$ where $[•]$ denotes floor function. E.g. $n=1$ yields $2$, $n=2$ yields $3$, $n=3$ yields $5$,...and so on. Is this what you are looking for?