Centered hexagonal number | Function to find centered hexagonal number ; Formula to calculate nth centered hexagonal ; Driver Code
def centeredHexagonalNumber ( n ) : NEW_LINE INDENT return 3 * n * ( n - 1 ) + 1 NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 10 NEW_LINE print ( n , " th ▁ centered ▁ hexagonal ▁ number : ▁ " , centeredHexagonalNumber ( n ) ) NEW_LINE DEDENT ' NEW_LINE