The method used is to first calculate the largest 4-digit perfect cube. To do this take the cube root of 9999=21.5 approx., so 21^3=9261 is the largest cube, but the sum of the digits is 18. 20^3=8000, sum of digits=8; 19^3=6859, sum of digits=28; 18^3=5832, sum of digits=18. Bingo!