A023855 a(n) = 1*(n) + 2*(n-1) + 3*(n-2) + ... + (n+1-k)*k, where k = floor((n+1)/2).
1, 2, 7, 10, 22, 28, 50, 60, 95, 110, 161, 182, 252, 280, 372, 408, 525, 570, 715, 770, 946, 1012, 1222, 1300, 1547, 1638, 1925, 2030, 2360, 2480, 2856, 2992, 3417, 3570, 4047, 4218, 4750, 4940, 5530, 5740, 6391, 6622, 7337, 7590, 8372, 8648, 9500, 9800, 10725, 11050
Offset: 1
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..10000
- Index entries for linear recurrences with constant coefficients, signature (1,3,-3,-3,3,1,-1)
Programs
-
Haskell
a023855 n = sum $ zipWith (*) [1 .. div (n+1) 2] [n, n-1 ..] -- Reinhard Zumkeller, Jan 23 2012
-
Magma
[(4*n^3 +15*n^2 +14*n +3 -3*(n+1)^2*(-1)^n)/48: n in [1..60]]; // G. C. Greubel, Jul 12 2022
-
Maple
seq(-(1/3)*floor((k+1)/2)^3 + (k/2)*floor((k+1)/2)^2 + ((3*k+2)/6)*floor((k+1)/2), k=1..100); # Wesley Ivan Hurt, Sep 18 2013
-
Mathematica
LinearRecurrence[{1,3,-3,-3,3,1,-1}, {1,2,7,10,22,28,50}, 60] (* Vincenzo Librandi, Jan 23 2012 *) Table[-Ceiling[n/2] (Ceiling[n/2] + 1) (2 Ceiling[n/2] - 3 n - 2)/6, {n, 100}] (* Wesley Ivan Hurt, Sep 20 2013 *)
-
PARI
a(n)=if(n%2, (n+1)*(n+3)*(2*n+1)/24, n*(n+1)*(n+2)/12)
-
PARI
my(x='x+O('x^99)); Vec(x*(1+x+2*x^2)/((1-x)^4*(1+x)^3)) \\ Altug Alkan, Mar 03 2018
-
SageMath
[(4*n^3 +15*n^2 +14*n +3 -3*(n+1)^2*(-1)^n)/48 for n in (1..60)] # G. C. Greubel, Jul 12 2022
Formula
a(n) = (n+1)*(n+3)*(2*n+1)/24 if n is odd, or n*(n+1)*(n+2)/12 if n is even.
G.f.: x*(1+x+2*x^2)/((1-x)^4*(1+x)^3). - Ralf Stephan, Apr 28 2004
a(n) = Sum_{i=1..ceiling(n/2)} i*(n-i+1) = -ceiling(n/2)*(ceiling(n/2)+1)*(2*ceiling(n/2)-3n-2)/6. - Wesley Ivan Hurt, Sep 19 2013
a(n) = (4*n^3 + 15*n^2 + 14*n + 3 - 3*(n+1)^2*(-1)^n)/48. - Luce ETIENNE, Oct 22 2014
a(n) = (A000292(n) + (n mod 2)*(ceiling(n/2))^2)/2. - Luc Rousseau, Feb 25 2018
E.g.f.: (1/24)*( x*(21+12*x+2*x^2)*cosh(x) + (3+12*x+15*x^2+2*x^3)*sinh(x) ). - G. C. Greubel, Jul 12 2022
Extensions
Formula, program, and slight revision by Charles R Greathouse IV, Feb 23 2010
Comments