Check if a number can be represented as sum of two consecutive perfect cubes | Function to check that a number is the sum of cubes of 2 consecutive numbers or not ; Condition to check if a number is the sum of cubes of 2 consecutive numbers or not ; Driver Code ; Function call
function isSumCube ( N ) { var a = parseInt ( Math . cbrt ( N ) ) ; var b = a - 1 ; return ( ( a * a * a + b * b * b ) == N ) ; } var i = 35 ; if ( isSumCube ( i ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; }