Series summation if T ( n ) is given and n is very large | Python 3 implementation of the approach ; Function to return the sum of the given series ; Driver code
from math import pow NEW_LINE MOD = 1000000007 NEW_LINE def sumOfSeries ( n ) : NEW_LINE INDENT ans = pow ( n % MOD , 2 ) NEW_LINE return ( ans % MOD ) NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT n = 10 NEW_LINE print ( int ( sumOfSeries ( n ) ) ) NEW_LINE DEDENT