login
A319547
a(n) = 1*2*3*4*5*6*7 - 8*9*10*11*12*13*14 + 15*16*17*18*19*20*21 - ... + (up to n).
8
1, 2, 6, 24, 120, 720, 5040, 5032, 4968, 4320, -2880, -90000, -1230480, -17292240, -17292225, -17292000, -17288160, -17218800, -15896880, 10614960, 568758960, 568758938, 568758454, 568746816, 568455360, 560865360, 355631760, -5398802640, -5398802611
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=7.
An alternating version of A319208.
FORMULA
a(n) = (-1)^floor(n/7) * Sum_{i=1..6} (1-sign((n-i) mod 7)) * (Product_{j=1..i} (n-j+1)) + Sum_{i=1..n} (-1)^(floor(i/7)+1) * (1-sign(i mod 7)) * (Product_{j=1..7} (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 = 5032;
a(9) = 1*2*3*4*5*6*7 - 8*9 = 4968;
a(10) = 1*2*3*4*5*6*7 - 8*9*10 = 4320;
a(11) = 1*2*3*4*5*6*7 - 8*9*10*11 = -2880;
a(12) = 1*2*3*4*5*6*7 - 8*9*10*11*12 = -90000;
a(13) = 1*2*3*4*5*6*7 - 8*9*10*11*12*13 = -1230480;
a(14) = 1*2*3*4*5*6*7 - 8*9*10*11*12*13*14 = -17292240;
a(15) = 1*2*3*4*5*6*7 - 8*9*10*11*12*13*14 + 15 = -17292225;
a(16) = 1*2*3*4*5*6*7 - 8*9*10*11*12*13*14 + 15*16 = -17292000; etc.
MATHEMATICA
a[n_]:=(-1)^Floor[n/7]*Sum[(1-Sign[Mod[n-i, 7]])*Product[n-j+1, {j, 1, i}], {i, 1, 6}]+Sum[(-1)^(Floor[i/7]+1)*(1-Sign[Mod[i, 7]])*Product[i-j+1, {j, 1, 6}], {i, 1, n}]; Array[a, 30] (* Stefano Spezia, Sep 23 2018 *)
CROSSREFS
For similar sequences, see: A001057 (k=1), A319373 (k=2), A319543 (k=3), A319544 (k=4), A319545 (k=5), A319546 (k=6), this sequence (k=7), A319549 (k=8), A319550 (k=9), A319551 (k=10).
Cf. A319208.
Sequence in context: A248772 A033645 A248769 * A319208 A276841 A364427
KEYWORD
sign,easy
AUTHOR
Wesley Ivan Hurt, Sep 22 2018
STATUS
approved