It is clear even without my explanations that for n >= 10 the cube of n,, has MORE digits than the square . Therefore, only 1-digit numbers must be checked n n^2 n^3 ----------------- 0 0 0 (*) 1 1 1 (*) 2 4 8 (*) 3 9 27 4 16 64 (*) 5 25 125 6 36 256 7 49 8 9 ---------------- For your convenience, I marked the favorable numbers by (*), so you can calculate the ANSWER on your own.