Centered triangular number | function for Centered Triangular number ; Formula to calculate nth Centered Triangular number ; Driver Code ; For 3 rd Centered Triangular number ; For 12 th Centered Triangular number
def Centered_Triangular_num ( n ) : NEW_LINE INDENT return ( 3 * n * n + 3 * n + 2 ) // 2 NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 3 NEW_LINE print ( Centered_Triangular_num ( n ) ) NEW_LINE n = 12 NEW_LINE print ( Centered_Triangular_num ( n ) ) NEW_LINE DEDENT