login
a(n) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13*14*15 - ... + (up to n).
9

%I #20 Oct 05 2018 09:00:41

%S 1,2,6,2,-14,-114,-107,-58,390,380,280,-930,-917,-748,1800,1784,1528,

%T -3096,-3077,-2716,4884,4862,4378,-7260,-7235,-6610,10290,10262,9478,

%U -14070,-14039,-13078,18666,18632,17476,-24174,-24137,-22768,30660,30620,29020

%N a(n) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13*14*15 - ... + (up to n).

%C In general, for alternating sequences that multiply the first k natural numbers, and subtract/add the products of the next k natural numbers (preserving the order of operations up to n), we have a(n) = (-1)^floor(n/k) * Sum_{i=1..k-1} (1-sign((n-i) mod k)) * (Product_{j=1..i} (n-j+1)) + Sum_{i=1..n} (-1)^(floor(i/k)+1) * (1-sign(i mod k)) * (Product_{j=1..k} (i-j+1)). Here k=3.

%C An alternating version of A319014.

%H Colin Barker, <a href="/A319543/b319543.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_13">Index entries for linear recurrences with constant coefficients</a>, signature (1,0,-4,4,0,-6,6,0,-4,4,0,-1,1).

%F a(n) = (-1)^floor(n/3) * Sum_{i=1..2} (1-sign((n-i) mod 3)) * (Product_{j=1..i} (n-j+1)) + Sum_{i=1..n} (-1)^(floor(i/3)+1) * (1-sign(i mod 3)) * (Product_{j=1..3} (i-j+1)).

%F From _Colin Barker_, Sep 23 2018: (Start)

%F G.f.: x*(1 + x + 4*x^2 - 12*x^4 - 84*x^5 - 3*x^6 - 9*x^7 + 72*x^8 - 2*x^9 + 4*x^10 - 2*x^11) / ((1 - x)*(1 + x)^4*(1 - x + x^2)^4).

%F a(n) = a(n-1) - 4*a(n-3) + 4*a(n-4) - 6*a(n-6) + 6*a(n-7) - 4*a(n-9) + 4*a(n-10) - a(n-12) + a(n-13) for n>13.

%F (End)

%e a(1) = 1;

%e a(2) = 1*2 = 2;

%e a(3) = 1*2*3 = 6;

%e a(4) = 1*2*3 - 4 = 2;

%e a(5) = 1*2*3 - 4*5 = -14;

%e a(6) = 1*2*3 - 4*5*6 = -114;

%e a(7) = 1*2*3 - 4*5*6 + 7 = -107;

%e a(8) = 1*2*3 - 4*5*6 + 7*8 = -58;

%e a(9) = 1*2*3 - 4*5*6 + 7*8*9 = 390;

%e a(10) = 1*2*3 - 4*5*6 + 7*8*9 - 10 = 380;

%e a(11) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11 = 280;

%e a(12) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 = -930;

%e a(13) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13 = -917;

%e a(14) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13*14 = -748;

%e a(15) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13*14*15 = 1800; etc.

%p seq(coeff(series((x*(1+x+4*x^2-12*x^4-84*x^5-3*x^6-9*x^7+72*x^8-2*x^9+4*x^10-2*x^11))/((1-x)*(1+x)^4*(1-x+x^2)^4),x,n+1), x, n), n = 1 .. 45); # _Muniru A Asiru_, Oct 01 2018

%t LinearRecurrence[{1, 0, -4, 4, 0, -6, 6, 0, -4, 4, 0, -1, 1},{1, 2, 6, 2, -14, -114, -107, -58, 390, 380, 280, -930, -917}, 40] (* _Stefano Spezia_, Sep 23 2018 *)

%o (PARI) Vec(x*(1 + x + 4*x^2 - 12*x^4 - 84*x^5 - 3*x^6 - 9*x^7 + 72*x^8 - 2*x^9 + 4*x^10 - 2*x^11) / ((1 - x)*(1 + x)^4*(1 - x + x^2)^4) + O(x^40)) \\ _Colin Barker_, Sep 23 2018

%Y For similar sequences, see: A001057 (k=1), A319373 (k=2), this sequence (k=3), A319544 (k=4), A319545 (k=5), A319546 (k=6), A319547 (k=7), A319549 (k=8), A319550 (k=9), A319551 (k=10).

%Y Cf. A319014.

%K sign,easy

%O 1,2

%A _Wesley Ivan Hurt_, Sep 22 2018