1.3.7.13.21.31 find the rule and express it with algebraic formula

1.3.7.13.21.31 find the rule and express it with algebraic formula

0+2+4+6+...+2(n-1)
=2(n-1)*n/2
=n(n-1)
an=1+n(n-1)
=n²-n+1