1=1
4=1+1+2
10=1+1+2+1+2+3
20=1+1+2+1+2+3+1+2+3+4
an=1+(1+2)+...+(1+2+3+...+n)
=1*2/2+2*3/2+...+n(n+1)/2
=1/2*((1+2^2+...+n^2)+(1+2+...+n))
=1/2*(n(n+1)(2n+1)/6+n(n+1)/2)
=n(n+1)(n+2)/6
1=1
4=1+1+2
10=1+1+2+1+2+3
20=1+1+2+1+2+3+1+2+3+4
an=1+(1+2)+...+(1+2+3+...+n)
=1*2/2+2*3/2+...+n(n+1)/2
=1/2*((1+2^2+...+n^2)+(1+2+...+n))
=1/2*(n(n+1)(2n+1)/6+n(n+1)/2)
=n(n+1)(n+2)/6