Find Nth number of the series 1 , 6 , 15 , 28 , 45 , ... . . | PHP program to find Nth term of the series ; function to return nth term of the series ; Taking n as 4 ; function call
< ? php $ mod = 1000000009 ; function NthTerm ( $ n ) { global $ mod ; $ x = ( 2 * $ n * $ n ) % $ mod ; return ( $ x - $ n + $ mod ) % $ mod ; } $ N = 4 ; echo NthTerm ( $ N ) ; ? >