login
A302130
a(n) = a(a(n-3)) + a(n-a(n-2)) with a(1) = a(2) = a(3) = a(4) = 1, a(5) = 2, a(6) = 5.
1
1, 1, 1, 1, 2, 5, 3, 2, 7, 3, 2, 10, 3, 2, 13, 3, 2, 16, 3, 2, 19, 3, 2, 22, 3, 2, 25, 3, 2, 28, 3, 2, 31, 3, 2, 34, 3, 2, 37, 3, 2, 40, 3, 2, 43, 3, 2, 46, 3, 2, 49, 3, 2, 52, 3, 2, 55, 3, 2, 58, 3, 2, 61, 3, 2, 64, 3, 2, 67, 3, 2, 70, 3, 2, 73, 3, 2, 76, 3, 2, 79, 3, 2, 82, 3, 2, 85, 3, 2, 88
OFFSET
1,5
COMMENTS
A quasi-periodic solution to the recurrence a(n) = a(a(n-3)) + a(n-a(n-2)).
FORMULA
From Colin Barker, Jun 20 2018: (Start)
G.f.: x*(1 + x + x^2 - x^3 + 3*x^5 + 2*x^6 - x^7 - 2*x^8 - 2*x^9 + x^11) / ((1 - x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6) for n>10.
(End)
EXAMPLE
a(3*k-2) = 3, a(3*k-1) = 2, a(3*k) = 3*k - 2 for k > 2.
MATHEMATICA
LinearRecurrence[{0, 0, 2, 0, 0, -1}, {1, 1, 1, 1, 2, 5, 3, 2, 7, 3, 2, 10}, 100] (* Harvey P. Dale, Apr 20 2022 *)
PROG
(PARI) a=vector(99); a[1]=a[2]=a[3]=a[4]=1; a[5]=2; a[6]=5; for(n=7, #a, a[n] = a[a[n-3]]+a[n-a[n-2]]); a
(PARI) Vec(x*(1 + x + x^2 - x^3 + 3*x^5 + 2*x^6 - x^7 - 2*x^8 - 2*x^9 + x^11) / ((1 - x)^2*(1 + x + x^2)^2) + O(x^80)) \\ Colin Barker, Jun 20 2018
(GAP) a:=[1, 1, 1, 1, 2, 5];; for n in [7..100] do a[n]:=a[a[n-3]]+a[n-a[n-2]]; od; a; # Muniru A Asiru, Jun 26 2018
CROSSREFS
Cf. A244477.
Sequence in context: A065261 A130848 A222760 * A156637 A195784 A279623
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Jun 20 2018
STATUS
approved