A039823 a(n) = ceiling( (n^2 + n + 2)/4 ).
1, 2, 4, 6, 8, 11, 15, 19, 23, 28, 34, 40, 46, 53, 61, 69, 77, 86, 96, 106, 116, 127, 139, 151, 163, 176, 190, 204, 218, 233, 249, 265, 281, 298, 316, 334, 352, 371, 391, 411, 431, 452, 474, 496, 518, 541, 565, 589, 613, 638, 664, 690, 716, 743, 771, 799, 827
Offset: 1
Examples
Possible absolute values of sums of consecutive integers with any sign combination for n = 4 and n=5 are {0, 2, 4, 6, 8, 10} and {1, 3, 5, 7, 9, 11, 13, 15} respectively. - _Olivier Gérard_, Mar 22 2010
Links
- Index entries for linear recurrences with constant coefficients, signature (3,-4,4,-3,1).
Programs
-
Magma
[Ceiling((n^2+n+2)/4) : n in [1..80]]; // Wesley Ivan Hurt, Sep 25 2015
-
Magma
I:=[1,2,4,6,8]; [n le 5 select I[n] else 3*Self(n-1)-4*Self(n-2)+4*Self(n-3)-3*Self(n-4)+Self(n-5): n in [1..60]]; // Vincenzo Librandi, Sep 26 2015
-
Maple
A039823:=n->ceil((n^2+n+2)/4): seq(A039823(n), n=1..100); # Wesley Ivan Hurt, Sep 25 2015
-
Mathematica
Table[Floor[((n*(n+1)+2)/2+1)/2],{n,5!}] (* Vladimir Joseph Stephan Orlovsky, Apr 26 2010 *) LinearRecurrence[{3, -4, 4, -3, 1}, {1, 2, 4, 6, 8}, 70] (* Vincenzo Librandi, Sep 26 2015 *)
-
Maxima
makelist((n*(n+1)+%i^(n*(n+1))+3)/4,n,1,57); /* Bruno Berselli, Jul 25 2012 */
-
PARI
a(n) = ceil((n^2+n+2)/4); vector(80, n, a(n)) \\ Altug Alkan, Sep 25 2015
Formula
a(n) = floor(binomial(n+1, 2)/2) + 1 = A011848(n+1) + 1.
G.f.: x*(x^4-2*x^3+2*x^2-x+1)/((1+x^2)*(1-x)^3).
a(n) = (n*(n+1)+i^(n*(n+1))+3)/4, where i=sqrt(-1). - Bruno Berselli, Jul 25 2012
a(n) = a(n-1) + A004524(n+1). - Bob Selcoe, Sep 25 2015
a(n) = 3*a(n-1)-4*a(n-2)+4*a(n-3)-3*a(n-4)+a(n-5) for n>5. - Wesley Ivan Hurt, Sep 25 2015
a(n) = ceiling( (n^2+n+1)/4 ). - Bob Selcoe, Sep 26 2015
Extensions
Edited by Ralf Stephan, Nov 15 2004
Comments