Find the Nth term of the series 2 + 6 + 13 + 23 + . . . | Java program to find Nth term of the series 2 + 6 + 13 + 23 + 36 + ... ; calculate Nth term of given series ; Driver code
import java . io . * ; class GFG { static int Nth_Term ( int n ) { return ( int ) ( 3 * Math . pow ( n , 2 ) - n + 2 ) / ( 2 ) ; } public static void main ( String [ ] args ) { int N = 5 ; System . out . println ( Nth_Term ( N ) ) ; } }