OFFSET
1,2
COMMENTS
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.
An alternating version of A319014.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,-4,4,0,-6,6,0,-4,4,0,-1,1).
FORMULA
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)).
From Colin Barker, Sep 23 2018: (Start)
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).
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.
(End)
EXAMPLE
a(1) = 1;
a(2) = 1*2 = 2;
a(3) = 1*2*3 = 6;
a(4) = 1*2*3 - 4 = 2;
a(5) = 1*2*3 - 4*5 = -14;
a(6) = 1*2*3 - 4*5*6 = -114;
a(7) = 1*2*3 - 4*5*6 + 7 = -107;
a(8) = 1*2*3 - 4*5*6 + 7*8 = -58;
a(9) = 1*2*3 - 4*5*6 + 7*8*9 = 390;
a(10) = 1*2*3 - 4*5*6 + 7*8*9 - 10 = 380;
a(11) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11 = 280;
a(12) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 = -930;
a(13) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13 = -917;
a(14) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13*14 = -748;
a(15) = 1*2*3 - 4*5*6 + 7*8*9 - 10*11*12 + 13*14*15 = 1800; etc.
MAPLE
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
MATHEMATICA
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 *)
PROG
(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
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Wesley Ivan Hurt, Sep 22 2018
STATUS
approved