Find Nth number of the series 1 , 6 , 15 , 28 , 45 , ... . . | function to return nth term of the series ; Taking n as 4 ; Printing the nth term
function NthTerm ( n ) { var x = ( 2 * n * n ) % 1000000009 ; return ( x - n + 1000000009 ) % 1000000009 ; } var N = 4 ; document . write ( NthTerm ( N ) ) ;