Sum of the first N Pronic Numbers | Java implementation implementation to find sum of first N terms ; Function to calculate the sum ; Driver code
class GFG { static int calculateSum ( int N ) { return N * ( N - 1 ) / 2 + N * ( N - 1 ) * ( 2 * N - 1 ) / 6 ; } public static void main ( String [ ] args ) { int N = 3 ; System . out . println ( calculateSum ( N ) ) ; } }