Check if a number can be represented as sum of two consecutive perfect cubes | Function to check if a number can be expressed as the sum of cubes of two consecutive numbers ; Driver Code
function isCubeSum ( n ) { for ( var i = 1 ; i * i * i <= n ; i ++ ) { if ( i * i * i + ( i + 1 ) * ( i + 1 ) * ( i + 1 ) == n ) return true ; } return false ; } var n = 35 ; if ( isCubeSum ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;