Find the sum of the first N Centered Decagonal Numbers | Function to find the N - th centred decagonal number ; Formula to calculate nth Centered_decagonal number & return it into main function . ; Function to find the sum of the first N Centered decagonal numbers ; Variable to store the sum ; Iterating through the range ; Driver code ; display first Nth Centered_decagonal number
def Centered_decagonal_num ( n ) : NEW_LINE INDENT return ( 5 * n * n - 5 * n + 1 ) NEW_LINE DEDENT def sum_Centered_decagonal_num ( n ) : NEW_LINE INDENT summ = 0 NEW_LINE for i in range ( 1 , n + 1 ) : NEW_LINE INDENT summ += Centered_decagonal_num ( i ) NEW_LINE DEDENT return summ NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 5 NEW_LINE print ( sum_Centered_decagonal_num ( n ) ) NEW_LINE DEDENT