Program to find the Nth term of the series 3 , 7 , 13 , 21 , 31. ... . | Java code to find the Nth term of given series . ; Function to calculate sum ; Return Nth term ; Driver program ; declaration of number of terms ; Get the Nth term
import java . util . * ; class solution { static long getNthTerm ( long N ) { return ( ( int ) Math . pow ( N , 2 ) + N + 1 ) ; } public static void main ( String arr [ ] ) { long N = 11 ; System . out . println ( getNthTerm ( N ) ) ; } }