OFFSET
0,5
COMMENTS
Piecewise linear depending on residue modulo 6. Might be described as an inverse Catalan transform of the nonnegative integers.
Number of compositions of n consisting of at most two parts, all congruent to {0,2} mod 3 (offset 1). - Vladeta Jovovic, Mar 10 2005
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
Index entries for linear recurrences with constant coefficients, signature (2,-3,2,-1).
FORMULA
a(n) = ( 2n*sin((n+1/2)*Pi/3) + sin(n*Pi/3)/sin(Pi/3) )/3. a(3n)=n*(-1)^n; a(3n+1)=(2n+1)*(-1)^n; a(3n+2)=(n+1)*(-1)^n.
a(n) = sum{k=0..floor(n/2), binomial(n-k, k)(-1)^k*(n-k)}. - Paul Barry, Nov 12 2004
Euler transform of length 6 sequence [ 1, -2, -2, 0, 0, 2]. - Michael Somos, Jul 14 2006
G.f.: x(1-x)/(1-x+x^2)^2 = x*(1-x^2)^2*(1-x^3)^2/((1-x)*(1-x^6)^2). a(-1-n)=a(n). - Michael Somos, Jul 14 2006
a(n+4) = 2*a(n+3)-3*a(n+2)+2*a(n+1)-a(n). - Robert Israel, Aug 07 2015
EXAMPLE
a(10) = -5*1 + 6*15 - 7*35 + 8*28 - 9*9 + 10*1 = -5 + 90 -245 + 224 - 81 + 10 = -7.
MAPLE
A076118:=n->add(k*(-1)^(n-k)*binomial(k, n-k), k=floor(n/2)..n); seq(A076118(n), n=0..50); # Wesley Ivan Hurt, May 08 2014
f:= gfun:-rectoproc({a(n+4) = 2*a(n+3)-3*a(n+2)+2*a(n+1)-a(n), a(0)=0, a(1)=1, a(2)=1, a(3)=-1}, a(n), remember):
map(f, [$0..100]); # Robert Israel, Aug 07 2015
MATHEMATICA
Table[Sum[k*(-1)^(n - k)*Binomial[k, n - k], {k, Floor[n/2], n}], {n,
0, 50}] (* Wesley Ivan Hurt, May 08 2014 *)
PROG
(PARI) {a(n)=local(k=n%3); n=n\3; (-1)^n*((k>0)+n+(k==1)*n)} /* Michael Somos, Jul 14 2006 */
(PARI) {a(n)=if(n<0, n=-1-n); polcoeff(x*(1-x)/(1-x+x^2)^2+x*O(x^n), n)} /* Michael Somos, Jul 14 2006 */
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Henry Bottomley, Oct 31 2002
STATUS
approved