Program to print the series 2 , 15 , 41 , 80 , 132 , 197 … till N terms | Java implementation to print the given with the given Nth term ; Function to print the series ; Generate the ith term and ; Driver Code
import java . util . * ; class GFG { static void printSeries ( int N ) { int ith_term = 0 ; for ( int i = 1 ; i <= N ; i ++ ) { ith_term = ( 13 * i * ( i - 1 ) ) / 2 + 2 ; System . out . print ( ith_term + " , ▁ " ) ; } } public static void main ( String [ ] args ) { int N = 7 ; printSeries ( N ) ; } }