n | Java program to find the n - th term in series ; Function to find nth term ; Driver Code
import java . io . * ; class Series { static int sumOfSeries ( int n ) { return n * ( n + 1 ) * ( 6 * n * n * n + 9 * n * n + n - 1 ) / 30 ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( sumOfSeries ( n ) ) ; } }