Centered Octagonal Number | Function to find centered octagonal number ; Formula to calculate nth centered octagonal number and return it into main function ; Driver Code
function centeredoctagonalNumber ( n ) { return 4 * n * ( n - 1 ) + 1 ; } var n = 6 ; document . write ( n + " " + " " ) ; document . write ( centeredoctagonalNumber ( n ) + " " ) ; n = 11 ; document . write ( n + " " + " " ) ; document . write ( centeredoctagonalNumber ( n ) ) ;