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=4.
An alternating version of A319205.
FORMULA
a(n) = (-1)^floor(n/4) * Sum_{i=1..3} (1-sign((n-i) mod 4)) * (Product_{j=1..i} (n-j+1)) + Sum_{i=1..n} (-1)^(floor(i/4)+1) * (1-sign(i mod 4)) * (Product_{j=1..4} (i-j+1)).
EXAMPLE
a(1) = 1;
a(2) = 1*2 = 2;
a(3) = 1*2*3 = 6;
a(4) = 1*2*3*4 = 24;
a(5) = 1*2*3*4 - 5 = 19;
a(6) = 1*2*3*4 - 5*6 = -6;
a(7) = 1*2*3*4 - 5*6*7 = -186;
a(8) = 1*2*3*4 - 5*6*7*8 = -1656;
a(9) = 1*2*3*4 - 5*6*7*8 + 9 = -1647;
a(10) = 1*2*3*4 - 5*6*7*8 + 9*10 = -1566;
a(11) = 1*2*3*4 - 5*6*7*8 + 9*10*11 = -666;
a(12) = 1*2*3*4 - 5*6*7*8 + 9*10*11*12 = 10224;
a(13) = 1*2*3*4 - 5*6*7*8 + 9*10*11*12 - 13 = 10211;
a(14) = 1*2*3*4 - 5*6*7*8 + 9*10*11*12 - 13*14 = 10042;
a(15) = 1*2*3*4 - 5*6*7*8 + 9*10*11*12 - 13*14*15 = 7494; etc.
MATHEMATICA
a[n_]:=(-1)^Floor[n/4]*Sum[(1-Sign[Mod[n-i, 4]])*Product[n-j+1, {j, 1, i}], {i, 1, 3}]+Sum[(-1)^(Floor[i/4]+1)*(1-Sign[Mod[i, 4]])*Product[i-j+1, {j, 1, 3}], {i, 1, n}]; Array[a, 30] (* Stefano Spezia, Sep 23 2018 *)
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Wesley Ivan Hurt, Sep 22 2018
STATUS
approved