Program to find Nth term of the series 3 , 12 , 29 , 54 , 87 , ... | Java program to find N - th term of the series : 3 , 12 , 29 , 54 , 87 , ... ; calculate Nth term of series ; Return Nth term ; Driver code ; declaration of number of terms ; Get the Nth term
import java . util . * ; class solution { static long getNthTerm ( long N ) { return 4 * ( long ) Math . pow ( N , 2 ) - 3 * N + 2 ; } public static void main ( String arr [ ] ) { long N = 10 ; System . out . println ( getNthTerm ( N ) ) ; } }