OFFSET
0,3
COMMENTS
The graph of the sequence appears random until n>16, after which the graph creates seven distinct lines.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,2,0,0,0,0,0,0,-1).
FORMULA
For n>16, the sequence follows a pattern of seven, and each term lies on one of the following lines:
If n is of the form 7k+3, then a(n) = (11/7)n+(30/7);
if n is of the form 7k+4, then a(n) = (4/7)n+(26/7);
if n is of the form 7k+5, then a(n) = (15/7)n+(30/7);
if n is of the form 7k+6, then a(n) = (8/7)n+(22/7);
if n is of the form 7k, then a(n) = (1/7)n+3;
if n is of the form 7k+1, then a(n) = (9/7)n+(26/7);
if n is of the form 7k+2, then a(n) = (2/7)n+(24/7).
From Colin Barker, Aug 29 2019: (Start)
G.f.: (1 + x + 2*x^2 + 3*x^3 + 5*x^4 + x^5 + 6*x^6 + 5*x^7 + 11*x^8 + x^9 + 12*x^10 - 2*x^11 + 24*x^12 + 2*x^13 - 12*x^14 - 10*x^15 + 8*x^16 - 2*x^17 + 3*x^18 - 6*x^19 + 4*x^20 + 11*x^21 + 15*x^22 - 17*x^23 - 2*x^24 - 2*x^25 - 4*x^26 - 4*x^27 - 4*x^28 - 8*x^29 + 8*x^30) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6)^2).
a(n) = 2*a(n-7) - a(n-14) for n>30.
(End)
MATHEMATICA
a[0] = a[1] = 1; a[n_] := a[n] = If[a[n - 1] <= n - 1, a[n - 1] + a[n - 2], a[n - 1] - n + 1]; Array[a, 100, 0] (* Amiram Eldar, Aug 29 2019 *)
PROG
(PARI) Vec((1 + x + 2*x^2 + 3*x^3 + 5*x^4 + x^5 + 6*x^6 + 5*x^7 + 11*x^8 + x^9 + 12*x^10 - 2*x^11 + 24*x^12 + 2*x^13 - 12*x^14 - 10*x^15 + 8*x^16 - 2*x^17 + 3*x^18 - 6*x^19 + 4*x^20 + 11*x^21 + 15*x^22 - 17*x^23 - 2*x^24 - 2*x^25 - 4*x^26 - 4*x^27 - 4*x^28 - 8*x^29 + 8*x^30) / ((1 - x)^2*(1 + x + x^2 + x^3 + x^4 + x^5 + x^6)^2) + O(x^40)) \\ Colin Barker, Aug 29 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jackson Haselhorst, Aug 28 2019
STATUS
approved