A235367 Sum of positive even numbers up to n^2.
0, 6, 20, 72, 156, 342, 600, 1056, 1640, 2550, 3660, 5256, 7140, 9702, 12656, 16512, 20880, 26406, 32580, 40200, 48620, 58806, 69960, 83232, 97656, 114582, 132860, 154056, 176820, 202950, 230880, 262656, 296480, 334662, 375156, 420552, 468540, 522006, 578360, 640800, 706440, 778806
Offset: 1
Examples
a(1) = 0 because there are no even numbers between 1 and itself. a(2) = 6 because between 1 and 2^2 there are the even numbers 2 and 4, which add up to 6. a(3) = 20 because between 1 and 3^2 there are the even numbers 2, 4, 6 and 8, which add up to 20.
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (2,2,-6,0,6,-2,-2,1).
Programs
-
Magma
[&+[i: i in [0..n^2 by 2]]: n in [1..50]]; // Bruno Berselli, Oct 26 2018
-
Mathematica
Table[((n^2 - Mod[n^2, 2])/4)(n^2 + 2 - Mod[n^2, 2]), {n, 40}] (* Alonso del Arte, Jan 16 2014 *)
-
PARI
a(n) = sum(i=1, n, i^2*(!(i % 2))); \\ Michel Marcus, Jan 18 2014
Formula
a(n) = (n^4 + 2n^2)/4 if n is even, a(n) = (n^4 - 1)/4 if n is odd.
a(n) = ((n^2 - (n^2 mod 2))/4)(n^2 + 2 - (n^2 mod 2)). - Alonso del Arte, Jan 16 2014
a(n) = A110660(n^2). - Michel Marcus, Jan 18 2014
G.f.: -2*x^2*(3*x^4+4*x^3+10*x^2+4*x+3) / ((x-1)^5*(x+1)^3). - Colin Barker, Jan 18 2014
Extensions
Corrected by Vincenzo Librandi, Jan 18 2014
Comments