Find Nth number of the series 1 , 6 , 15 , 28 , 45 , ... . . | CPP program to find Nth term of the series ; function to return nth term of the series ; Driver code ; Taking n as 4 ; Printing the nth term
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define mod  1000000009 NEW_LINE int NthTerm ( long long n ) { long long x = ( 2 * n * n ) % mod ; return ( x - n + mod ) % mod ; } int main ( ) { long long N = 4 ; cout << NthTerm ( N ) ; return 0 ; }