## Sum of consecutive Squares

Calculate the sum of first n squares or the sum of consecutive square numbers from n_{1}

^{2 }to n

_{2}

^{2 }. A square number (or a square) is a number you can write as a product of two equal factors of natural numbers. The sum of consecutive square numbers from n

_{1}

^{2 }to n

_{2}

^{2 }is equal to:

n

_{1}

^{2 }+ (n

_{1}+ 1)

^{2}+ ... + n

_{2}

^{2}

let's understand the simple method to calculate the Sum of consecutive squares for given value as follows:

for example we input these value 5 it means we wants the sum of 1

^{2},2

^{2},3

^{2},4

^{2}, and 5

^{2}

= 1x1 + 2x2 + 3x3 + 4x4 + 5x5

= 1 + 4 + 9 + 16 + 25

= 55

now calculate the same example using following formula:

Sum of consecutive squares = n(n + 1)(2n + 1)/6

= 5(5 + 1)(2x5 + 1)/6

= (5x6)(11)/6

= 5x6x11/6

= 5x11

= 55