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