Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #11 Mar 09 2024 11:44:47
%S 2,1,3,5,1,3,8,1,3,11,1,3,14,1,3,17,1,3,20,1,3,23,1,3,26,1,3,29,1,3,
%T 32,1,3,35,1,3,38,1,3,41,1,3,44,1,3,47,1,3,50,1,3,53,1,3,56,1,3,59,1,
%U 3,62,1,3,65,1,3,68,1,3,71,1,3,74,1,3
%N A quasilinear solution to Hofstadter's Q recurrence.
%C a(n) is the solution to the recurrence relation a(n) = a(n-a(n-1)) +a(n-a(n-2)) [Hofstadter's Q recurrence], with the initial conditions: a(1) = 2, a(2) = 1.
%C This sequence is a close relative of A283878.
%H Nathan Fox, <a href="/A284429/b284429.txt">Table of n, a(n) for n = 1..10000</a>
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0, 0, 2, 0, 0, -1).
%F G.f.: (-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2).
%F a(n) = 2*a(n-3) - a(n-6) for n > 6.
%F a(3*k) = 3,
%F a(3*k+1) = 3*k+2,
%F a(3*k+2) = 1.
%p A284429:=proc(n) option remember: if n <= 0 then 0: elif n = 1 then 2: elif n = 2 then 1: else A284429(n-A284429(n-1)) + A284429(n-A284429(n-2)): fi: end:
%t CoefficientList[Series[(-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2), {x, 0, 100}], x] (* _Indranil Ghosh_, Mar 27 2017 *)
%o (PARI) Vec((-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2) + O(x^100)) \\ _Indranil Ghosh_, Mar 27 2017
%Y Cf. A005185, A188670, A244477, A264756, A283878, A283879.
%K nonn,easy
%O 1,1
%A _Nathan Fox_, Mar 26 2017