OFFSET
1,2
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,3,-1,-2).
FORMULA
a(n) = 2*a(n-1) + n/2 if n is even; a(n) = 2*a(n-1) - (n-1)/2 if n is odd, with a(1)=1. - Vincenzo Librandi, Sep 30 2010
G.f.: -x*(-1-2*x+x^2+x^3) / ( (2*x-1)*(x-1)*(1+x)^2 ). - R. J. Mathar, Nov 18 2010
a(n) = 13*2^n/18 - 1/4 + (-1)^n*(n/6+1/36) = a(n-1) + 3*a(n-2) - a(n-3) - 2*a(n-4). - R. J. Mathar, Nov 18 2010
MATHEMATICA
LinearRecurrence[{1, 3, -1, -2}, {1, 3, 5, 12}, 50] (* Paolo Xausa, Jan 04 2024 *)
PROG
(PARI) Vec(-x*(-1-2*x+x^2+x^3)/((2*x-1)*(x-1)*(1+x)^2) + O(x^40)) \\ Michel Marcus, Aug 15 2015
(PARI) first(m)=my(v=vector(m)); v[1]=1; for(i=2, m, v[i]=2*v[i-1]+(-1)^i*floor(i/2)); v; \\ Anders Hellström, Aug 15 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robert Wainwright (RWainwright(AT)Iona.edu), May 03 2010
EXTENSIONS
Edited by N. J. A. Sloane, May 06 2010
STATUS
approved