Centered Octagonal Number | Function to find centered octagonal number ; Formula to calculate nth centered octagonal number ; Driver Code
def cen_octagonalnum ( n ) : NEW_LINE INDENT return ( 4 * n * n - 4 * n + 1 ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 6 NEW_LINE print ( n , " th ▁ Centered " , " octagonal ▁ number : ▁ " , cen_octagonalnum ( n ) ) NEW_LINE n = 11 NEW_LINE print ( n , " th ▁ Centered " , " octagonal ▁ number : ▁ " , cen_octagonalnum ( n ) ) NEW_LINE DEDENT