OFFSET
0,2
COMMENTS
Partial sums are A084104.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,-1).
FORMULA
G.f.: (1+x)^3/(1+x^3).
a(n) = Sum_{k=0..n} binomial(2n-k-1, k)(-1)^k*3(n-k). - Paul Barry, Jan 21 2005
a(0) = 1 and a(n) = 2*sqrt(3)*sin(n*Pi/3). - N-E. Fahssi, Mar 04 2010
Euler transform of length 6 sequence [3, -3, -1, 0, 0, 1]. - Michael Somos, Feb 13 2011
a(n) = -a(-n) = 3 * A128834(n) except a(0) = 1. - Michael Somos, Feb 13 2011
a(n) = 3*(n^2 mod 3)*(-1)^floor(n/3), n>0. - Wesley Ivan Hurt, May 15 2015
The periodic sequence b(n) = a(n+1) has the o.g.f. 3 + G(x) = 3 + 3x(1-x) / (1-x(1-x)) = 3 + 3 L(Cinv(x)) = 3 + 3 x - 3 x^3 - 3 x^4 + ... , where L(x) = x/(1-x) with inverse Linv(x) = x/(1+x) and Cinv(x) = x(1-x), the inverse of the o.g.f. for the shifted Catalan numbers of A000108, C(x) = (1-sqrt(1-4x))/2. Then Ginv(x) = C(Linv(x/3)) = [1 - sqrt[1-4x/(3+x)]]/2. Cf. A267633. - Tom Copeland, Jan 25 2016
EXAMPLE
1 + 3*x + 3*x^2 - 3*x^4 - 3*x^5 + 3*x^7 + 3*x^8 - 3*x^10 - 3*x^11 + ...
MAPLE
1, seq(op((-1)^i*[3, 3, 0]), i=0..20); # Robert Israel, May 17 2015
MATHEMATICA
CoefficientList[Series[(1 + x)^3/(1 + x^3), {x, 0, 100}], x] (* Vincenzo Librandi, May 16 2015 *)
Join[{1}, LinearRecurrence[{1, -1}, {3, 3}, 30]] (* G. C. Greubel, Jan 15 2018 *)
PROG
(PARI) {a(n) = (n==0) + [0, 3, 3, 0, -3, -3][n%6 + 1]} /* Michael Somos, Feb 13 2011 */
(PARI) {a(n) = (n==0) - 3 * (-1)^n * kronecker(-3, n)} /* Michael Somos, Feb 13 2011 */
(Magma) I:=[1, 3, 3]; [n le 3 select I[n] else Self(n-1)-Self(n-2): n in [1..100]]; // Vincenzo Librandi, May 16 2015
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Paul Barry, May 15 2003
STATUS
approved