# What is the explicit formula for the nth nonsquare and nth noncube?

By a nonsquare(noncube) I mean a natural no. which is not a perfect square(perfect cube).For example the first few terms of the 2nd. sequence are 2,3,4,5,6,7,9,.. How can we derive the expression for the nth nonsquare and the nth noncube?

For the $n$'th non $k$-power, we can derive the following:
The $n$'th power of $k$ happens at $n^k$. The sequence of non-$k$-powers always increases one, except when passing a $k$-power. Without further ado, here is a formula (where the first term is $f(1)$): $$f(n)=n+\left\lfloor \sqrt[k]{n+\lfloor\sqrt[k]n\rfloor}\right\rfloor$$ The part within the outermost root is a first formula, but it won't work, because it increases the sequence on term $4$, $9$, $25$, etc for the non-squares, but the $25$'th term is $28$, because you already passes three squares. Therefore, we supply the first formula as index for the good one.
I hope this is understandable. If not, try to understand what happens below. The first column is $n$, the second one the wrong formula $n+\lfloor\sqrt kn\rfloor$ and the last column the right formula. $$\begin{array}{ccc} 1 & 2 & 2 \\ 2 & 3 & 3 \\ 3 & 4 & 5 \\ 4 & 6 & 6 \\ 5 & 7 & 7 \\ 6 & 8 & 8 \\ 7 & 9 & 10 \\ 8 & 10 & 11 \\ 9 & 12 & 12 \\ 10 & 13 & 13 \\ 11 & 14 & 14 \\ 12 & 15 & 15 \\ 13 & 16 & 17 \\ 14 & 17 & 18 \\ 15 & 18 & 19 \\ 16 & 20 & 20 \\ 17 & 21 & 21 \\ 18 & 22 & 22 \\ 19 & 23 & 23 \\ 20 & 24 & 24 \\ 21 & 25 & 26 \\ 22 & 26 & 27 \\ 23 & 27 & 28 \\ 24 & 28 & 29 \\ 25 & 30 & 30 \\ 26 & 31 & 31 \\ 27 & 32 & 32 \\ 28 & 33 & 33 \\ 29 & 34 & 34 \\ 30 & 35 & 35 \\ 31 & 36 & 37 \\ 32 & 37 & 38 \\ 33 & 38 & 39 \\ \end{array}$$