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=9.
An alternating version of A319211.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
FORMULA
a(n) = (-1)^floor(n/9) * Sum_{i=1..8} (1-sign((n-i) mod 9)) * (Product_{j=1..i} (n-j+1)) + Sum_{i=1..n} (-1)^(floor(i/9)+1) * (1-sign(i mod 9)) * (Product_{j=1..9} (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 = 120;
a(6) = 1*2*3*4*5*6 = 720;
a(7) = 1*2*3*4*5*6*7 = 5040;
a(8) = 1*2*3*4*5*6*7*8 = 40320;
a(9) = 1*2*3*4*5*6*7*8*9 = 362880;
a(10) = 1*2*3*4*5*6*7*8*9 - 10 = 362870;
a(11) = 1*2*3*4*5*6*7*8*9 - 10*11 = 362770;
a(12) = 1*2*3*4*5*6*7*8*9 - 10*11*12 = 361560;
a(13) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13 = 345720;
a(14) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13*14 = 122640;
a(15) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13*14*15 = -3240720;
a(16) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13*14*15*16 = -57294720;
a(17) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13*14*15*16*17 = -979816320;
a(18) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13*14*15*16*17*18 = -17642862720;
a(19) = 1*2*3*4*5*6*7*8*9 - 10*11*12*13*14*15*16*17*18 + 19 = -17642862701; etc.
MATHEMATICA
Table[Total[Times@@@Partition[Riffle[Times@@@Partition[Range[n], UpTo[9]], {1, -1}, {1, -1, 2}], 2]], {n, 30}] (* Harvey P. Dale, Oct 05 2024 *)
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Wesley Ivan Hurt, Sep 22 2018
STATUS
approved