Summing the sum series | Python3 program to calculate the terms of summing of sum series ; Function to calculate twice of sum of first N natural numbers ; Function to calculate the terms of summing of sum series ;
MOD = 1000000007 NEW_LINE def Sum ( N ) : NEW_LINE INDENT val = N * ( N + 1 ) NEW_LINE val = val % MOD NEW_LINE return val NEW_LINE DEDENT def sumX ( N , M , K ) : NEW_LINE INDENT for i in range ( M ) : NEW_LINE INDENT N = int ( Sum ( K + N ) ) NEW_LINE DEDENT N = N % MOD NEW_LINE return N NEW_LINE DEDENT / * Driver code * / NEW_LINE if __name__ == " _ _ main _ _ " : NEW_LINE INDENT N , M , K = 1 , 2 , 3 NEW_LINE print ( sumX ( N , M , K ) ) NEW_LINE DEDENT