OFFSET
0,1
COMMENTS
A sequence defined by a(1)=1, a(n)=k*n-a(n-1), k a constant parameter, has recurrence a(n)= 3*a(n-1) -3*a(n-2) +a(n-3). Its generating function is x*(1+2*(k-1)*x+(1-k)*x^2)/((1+x)*(1-x)^2). The closed form is a(n) = k*n/2+k/4+(-1)^n*(3*k/4-1). This applies with k=3 to this sequence here, and for example to sequences A165033, and A166519-A166525. - R. J. Mathar, Oct 17 2009
From Paul Curtz, Feb 20 2010: (Start)
Also: A001651, terms swapped by pairs.
a(n) mod 9 defines a period-6 sequence which is a permutation of A141425. (End)
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
a(n) = 3*n - a(n-1).
From Paul Curtz, Feb 20 2010: (Start)
a(n+1)-a(n) = (-1)^(n+1)*A010685(n).
Second differences: |a(n+2)-2*a(n+1)+a(n)| = A010716(n).
a(2*n) + a(2*n+1) = A016945(n) = 6*n+3.
a(2*n) = A016945(n).
a(2*n+1) = A016777(n). (End)
G.f. ( 2-x+2*x^2 ) / ( (1+x)*(x-1)^2 ). - R. J. Mathar, Mar 08 2011
E.g.f.: (1/4)*exp(-x)*(5 + 3*exp(2*x) + 6*x*exp(2*x)). - G. C. Greubel, May 15 2016
Sum_{n>=0} (-1)^(n+1)/a(n) = Pi/(3*sqrt(3)) (A073010). - Amiram Eldar, Feb 24 2023
MATHEMATICA
CoefficientList[Series[(2 x^2 - x + 2)/((1 + x) (x - 1)^2), {x, 0, 80}], x] (* Harvey P. Dale, Mar 25 2011 *)
Table[(3 + 5 (-1)^n + 6 n) / 4, {n, 0, 100}] (* Vincenzo Librandi, Sep 13 2013 *)
PROG
(Magma) [(3 +5*(-1)^n+6*n)/4: n in [0..80]]; // Vincenzo Librandi, Sep 13 2013
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Oct 16 2009
EXTENSIONS
a(0)=2 added by Paul Curtz, Feb 20 2010
STATUS
approved