Function to print the required numbers less than n
static void printValidNums ( int n ) { int cbrt_n = ( int ) Math . cbrt ( n ) ; for ( int i = 1 ; i <= cbrt_n ; i ++ ) { int cube = ( int ) Math . pow ( i , 3 ) ;