login
a(n) = sum_k {n/2<=k<=n} k * (-1)^(n-k) * C(k,n-k).
10

%I #26 Jul 08 2022 09:54:37

%S 0,1,1,-1,-3,-2,2,5,3,-3,-7,-4,4,9,5,-5,-11,-6,6,13,7,-7,-15,-8,8,17,

%T 9,-9,-19,-10,10,21,11,-11,-23,-12,12,25,13,-13,-27,-14,14,29,15,-15,

%U -31,-16,16,33,17,-17,-35,-18,18,37,19,-19,-39,-20,20,41,21,-21,-43,-22,22,45,23,-23,-47,-24,24,49,25,-25,-51,-26,26

%N a(n) = sum_k {n/2<=k<=n} k * (-1)^(n-k) * C(k,n-k).

%C Piecewise linear depending on residue modulo 6. Might be described as an inverse Catalan transform of the nonnegative integers.

%C 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

%H Robert Israel, <a href="/A076118/b076118.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,-3,2,-1).

%F 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.

%F a(n) = sum{k=0..floor(n/2), binomial(n-k, k)(-1)^k*(n-k)}. - _Paul Barry_, Nov 12 2004

%F Euler transform of length 6 sequence [ 1, -2, -2, 0, 0, 2]. - _Michael Somos_, Jul 14 2006

%F 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

%F a(n+4) = 2*a(n+3)-3*a(n+2)+2*a(n+1)-a(n). - _Robert Israel_, Aug 07 2015

%F a(n) = A099254(n-1)-A099254(n-2). - _R. J. Mathar_, Apr 01 2018

%e a(10) = -5*1 + 6*15 - 7*35 + 8*28 - 9*9 + 10*1 = -5 + 90 -245 + 224 - 81 + 10 = -7.

%p 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

%p 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):

%p map(f, [$0..100]); # _Robert Israel_, Aug 07 2015

%t Table[Sum[k*(-1)^(n - k)*Binomial[k, n - k], {k, Floor[n/2], n}], {n,

%t 0, 50}] (* _Wesley Ivan Hurt_, May 08 2014 *)

%o (PARI) {a(n)=local(k=n%3); n=n\3; (-1)^n*((k>0)+n+(k==1)*n)} /* _Michael Somos_, Jul 14 2006 */

%o (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 */

%Y Cf. A038608(n)=a(3n)=-a(3n-1).

%Y Cf. A078028, A099254 (partial sums).

%Y See A151842 for a version without signs.

%K sign,easy

%O 0,5

%A _Henry Bottomley_, Oct 31 2002