Centered cube number | Function to find Centered cube number ; Formula to calculate nth Centered cube number & return it into main function . ; Driver Code
function centered_cube ( n ) { return ( 2 * n + 1 ) * ( n * n + n + 1 ) ; } let n = 3 ; document . write ( n + " " ) ; document . write ( centered_cube ( n ) ) ; document . write ( " " ) ; n = 10 ; document . write ( n + " " ) ; document . write ( centered_cube ( n ) ) ;