Centered hexagonal number | Function to find centered hexadecimal number . ; Formula to calculate nth centered hexadecimal number and return it into main function . ; Driver Code
function centeredHexagonalNumber ( n ) { return 3 * n * ( n - 1 ) + 1 ; } let n = 10 ; document . write ( n + " " ) ; document . write ( centeredHexagonalNumber ( n ) ) ;