Program to find the Nth number of the series 2 , 10 , 24 , 44 , 70. ... . | CPP program to find the Nth term of the series 2 , 10 , 24 , 44 , 70. ... . ; function to return nth term of the series ; Driver code ; Get N ; Get Nth term
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define mod  1000000009 NEW_LINE int NthTerm ( long long n ) { long long x = ( 3 * n * n ) % mod ; return ( x - n + mod ) % mod ; } int main ( ) { long long N = 4 ; cout << NthTerm ( N ) ; return 0 ; }