login
A296786
a(1) = a(2) = a(5) = 2, a(3) = 1, a(4) = 3, a(6) = 5; a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3)) for n > 6.
2
2, 2, 1, 3, 2, 5, 7, 8, 7, 4, 11, 12, 11, 4, 15, 16, 15, 4, 19, 20, 19, 4, 23, 24, 23, 4, 27, 28, 27, 4, 31, 32, 31, 4, 35, 36, 35, 4, 39, 40, 39, 4, 43, 44, 43, 4, 47, 48, 47, 4, 51, 52, 51, 4, 55, 56, 55, 4, 59, 60, 59, 4, 63, 64, 63, 4, 67, 68, 67, 4, 71, 72, 71, 4, 75, 76, 75, 4, 79, 80, 79, 4
OFFSET
1,1
COMMENTS
A quasi-periodic solution to the three-term Hofstadter recurrence a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3)). See comments in A296518.
LINKS
Altug Alkan, On a conjecture about generalized Q-recurrence, Open Mathematics (2018) Vol. 16, Issue 1, 1490-1500.
FORMULA
a(4*k-1) = a(4*k+1) = 4*k-1, a(4*k) = 4*k, a(4*k+2) = 4, for k > 1.
From Colin Barker, Dec 28 2017: (Start)
G.f.: x*(2 + 2*x + x^2 + 3*x^3 - 2*x^4 + x^5 + 5*x^6 + 2*x^7 + 5*x^8 - 4*x^9 - 2*x^10 - x^11 - x^12 + x^13) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2).
a(n) = 2*a(n-4) - a(n-8) for n>14.
(End)
MAPLE
a:= proc(n) option remember; procname(n-procname(n-1))+procname(n-procname(n-2))+procname(n-procname(n-3)) end proc:
a(1):= 2: a(2):= 2: a(3):= 1: a(4):= 3: a(5):= 2: a(6):= 5:
map(a, [$1..100]); # after Robert Israel at A296440
MATHEMATICA
a[n_] := a[n] = If[n<7, {2, 2, 1, 3, 2, 5}[[n]], a[n - a[n-1]] + a[n - a[n-2]] + a[n - a[n-3]]]; Array[a, 100] (* after Giovanni Resta at A296440 *)
PROG
(PARI) q=vector(10^5); q[1]=2; q[2]=2; q[3]=1; q[4]=3; q[5]=2; q[6]=5; for(n=7, #q, q[n] = q[n-q[n-1]]+q[n-q[n-2]]+q[n-q[n-3]]); q
(PARI) Vec(x*(2 + 2*x + x^2 + 3*x^3 - 2*x^4 + x^5 + 5*x^6 + 2*x^7 + 5*x^8 - 4*x^9 - 2*x^10 - x^11 - x^12 + x^13) / ((1 - x)^2*(1 + x)^2*(1 + x^2)^2) + O(x^100)) \\ Colin Barker, Dec 29 2017
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Dec 20 2017
STATUS
approved