Series summation if T ( n ) is given and n is very large | PHP implementation of the approach ; Function to return the sum of the given series ; Driver code
< ? php $ GLOBALS [ ' MOD ' ] = 1000000007 ; function sumOfSeries ( $ n ) { $ ans = pow ( $ n % $ GLOBALS [ ' MOD ' ] , 2 ) ; return ( $ ans % $ GLOBALS [ ' MOD ' ] ) ; } $ n = 10 ; echo sumOfSeries ( $ n ) ; ? >