Program to find the Nth term of the series 0 , 14 , 40 , 78 , 124 , ... | Java program to find the N - th term of the series 0 , 14 , 40 , 78 , 124 . . . ; calculate sum up to Nth term of series ; return the final sum ; Driver code
import java . util . * ; class solution { static int nthTerm ( int n ) { return 6 * ( int ) Math . pow ( n , 2 ) - 4 * n - 2 ; } public static void main ( String arr [ ] ) { int N = 4 ; System . out . println ( nthTerm ( N ) ) ; } }