Hi, the formula is ((N+1)*N)/2. In this first the jvm calculate the (N+1) ,after it multiply the result of (N+1) with N and it perform the division opertation on result (N+1)*N with 2.

hence ...