OFFSET
1,2
COMMENTS
In general, for sequences that multiply the first k natural numbers, and then add the product of the next k natural numbers (preserving the order of operations up to n), we have a(n) = Sum_{i=1..floor(n/k)} (k*i)!/(k*i-k)! + Sum_{j=1..k-1} (1-sign((n-j) mod k)) * (Product_{i=1..j} n-i+1). Here, k=5.
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,6,-6,0,0,0,-15,15,0,0,0,20,-20,0,0,0,-15,15,0,0,0,6,-6,0,0,0,-1,1).
FORMULA
a(n) = Sum_{i=1..floor(n/5)} (5*i)!/(5*i-5)! + Sum_{j=1..4} (1-sign((n-j) mod 5)) * (Product_{i=1..j} n-i+1).
From Colin Barker, Sep 14 2018: (Start)
G.f.: x*(1 + x + 4*x^2 + 18*x^3 + 96*x^4 + 30*x^6 + 270*x^7 + 2580*x^8 + 26640*x^9 - 10*x^10 - 80*x^11 - 120*x^12 + 6450*x^13 + 174480*x^14 + 20*x^15 + 50*x^16 - 550*x^17 - 5760*x^18 + 155760*x^19 - 15*x^20 + 15*x^21 + 360*x^22 - 3240*x^23 + 18000*x^24 + 4*x^25 - 16*x^26 + 36*x^27 - 48*x^28 + 24*x^29) / ((1 - x)^7*(1 + x + x^2 + x^3 + x^4)^6).
a(n) = a(n-1) + 6*a(n-5) - 6*a(n-6) - 15*a(n-10) + 15*a(n-11) + 20*a(n-15) - 20*a(n-16) - 15*a(n-20) + 15*a(n-21) + 6*a(n-25) - 6*a(n-26) - a(n-30) + a(n-31) for n>31.
(End)
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 = 126;
a(7) = 1*2*3*4*5 + 6*7 = 162;
a(8) = 1*2*3*4*5 + 6*7*8 = 456;
a(9) = 1*2*3*4*5 + 6*7*8*9 = 3144;
a(10) = 1*2*3*4*5 + 6*7*8*9*10 = 30360;
a(11) = 1*2*3*4*5 + 6*7*8*9*10 + 11 = 30371;
a(12) = 1*2*3*4*5 + 6*7*8*9*10 + 11*12 = 30492; etc.
MATHEMATICA
a[n_]:=Sum[(5*i)!/(5*i-5)!, {i, 1, Floor[n/5] }] + Sum[(1-Sign[Mod[n-j, 5]])*Product[n-i+1, {i, 1, j}], {j, 1, 4}] ; Array[a, 34] (* Stefano Spezia, Apr 18 2023 *)
PROG
(PARI) Vec(x*(1 + x + 4*x^2 + 18*x^3 + 96*x^4 + 30*x^6 + 270*x^7 + 2580*x^8 + 26640*x^9 - 10*x^10 - 80*x^11 - 120*x^12 + 6450*x^13 + 174480*x^14 + 20*x^15 + 50*x^16 - 550*x^17 - 5760*x^18 + 155760*x^19 - 15*x^20 + 15*x^21 + 360*x^22 - 3240*x^23 + 18000*x^24 + 4*x^25 - 16*x^26 + 36*x^27 - 48*x^28 + 24*x^29) / ((1 - x)^7*(1 + x + x^2 + x^3 + x^4)^6) + O(x^40)) \\ Colin Barker, Sep 14 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Wesley Ivan Hurt, Sep 13 2018
STATUS
approved