Function to generate a fixed number of even or odd terms . The size of r decides whether numbers to be generated even or odd .
vector < long long int > gen ( long long int n , vector < long long int > r ) { long long int a = r [ r . size ( ) - 1 ] ; a ++ ; for ( int i = 1 ; i <= n ; a += 2 , i ++ ) r . push_back ( a ) ; return r ; }