Series summation if T ( n ) is given and n is very large | C ++ implementation of the approach ; Function to return the sum of the given series ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define ll  long long int NEW_LINE #define MOD  1000000007 NEW_LINE int sumOfSeries ( int n ) { ll ans = ( ll ) pow ( n % MOD , 2 ) ; return ( ans % MOD ) ; } int main ( ) { int n = 10 ; cout << sumOfSeries ( n ) ; return 0 ; }