How can I calculate the number of perfect cubes among the first $4000$ positive integers?

If you live in the world of base-2 geekdom, simply note that $2^{12}$ a.k.a. $16^3$ is 4K, or 4096. This is obviously too large. The barest mental math estimation will verify that $15^3 < 4000$. Done.


You could find the largest cube $\le 4000$.

$\sqrt[3]{4000} \approx 15.9$, so there are $15$ perfect cubes among the first $4000$ positive integers.


If you didn't have a calculator and needed to work out what the largest integer $x$ was such that $x^3\leq4000$ without just computing $\sqrt[3]{4000}$, then you could estimate it - $10^3=1000$, $20^3=8000$ so $10<x<20$. Then keep narrowing it down, e.g. go halfway $15^3=225\cdot15=2250+1125=3375$, and $16^3=256\cdot16=2560+1536>4000$.

So there are $15$.


Is there any trick to find such questions?

Google, I would suppose. I think you meant to say "to find the answers to such questions." And yes, there is, though to me it seems too elementary to call it a "trick." To the find how many perfect $k$-th powers there are among the first $n$ positive integers, you just have to compute $\lfloor \root k \of n \rfloor$. (Note that if $k$ is even, you don't strictly need to specify "positive," but your answer might be off by $1$ from the answer key if it's not clear whether $0^k$ is meant to be included.)

How to calculate number of perfect cubes among the among the first $4000$ positive integers?

We see that $\root 3 \of {4000} \approx 15.874$, and then we verify that $15^3 = 3375 < 4000$ and $16^3 = 4096 > 4000$. Therefore the cubes you're looking for are $$1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, 1331, 1728, 2197, 2744, 3375$$ (the first sixteen listed in Sloane's A000578, but with $0$ omitted).