Find the sum of the first Nth Centered Hexadecagonal Number | Centered_Hexadecagonal number function ; Formula to calculate nth Centered_Hexadecagonal number & return it into main function . ; Function to find the sum of the first N Centered Hexadecagonal number ; Variable to store the sum ; Loop to iterate through the first N numbers ; Find the sum ; Driver Code ; display first Nth Centered_Hexadecagonal number
def Centered_Hexadecagonal_num ( n ) : NEW_LINE INDENT return ( 8 * n * n - 8 * n + 1 ) NEW_LINE DEDENT def sum_Centered_Hexadecagonal_num ( n ) : NEW_LINE INDENT summ = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT summ += Centered_Hexadecagonal_num ( i ) NEW_LINE DEDENT return summ NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 5 NEW_LINE print ( sum_Centered_Hexadecagonal_num ( n ) ) NEW_LINE DEDENT