cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A283878 An eventually quasilinear solution to Hofstadter's Q recurrence.

This page as a plain text file.
%I A283878 #12 Mar 09 2024 11:41:16
%S A283878 0,2,3,1,3,6,1,3,9,1,3,12,1,3,15,1,3,18,1,3,21,1,3,24,1,3,27,1,3,30,1,
%T A283878 3,33,1,3,36,1,3,39,1,3,42,1,3,45,1,3,48,1,3,51,1,3,54,1,3,57,1,3,60,
%U A283878 1,3,63,1,3,66,1,3,69,1,3,72,1,3,75
%N A283878 An eventually quasilinear solution to Hofstadter's Q recurrence.
%C A283878 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(n) = 0 if n <= 0; a(1) = 0, a(2) = 2, a(3) = 3, a(4) = 1.
%H A283878 Nathan Fox, <a href="/A283878/b283878.txt">Table of n, a(n) for n = 1..10000</a>
%H A283878 <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0, 0, 2, 0, 0, -1).
%F A283878 G.f.: (-x*(x^6 + x^5 + x^3 - x^2 - 3*x - 2)) / ((-1 + x)^2*(1 + x + x^2)^2).
%F A283878 a(n) = 2*a(n-3) - a(n-6) for n > 8.
%F A283878 a(1) = 0, a(2) = 2; thereafter a(3*k) = 3*k, a(3*k+1) = 1, a(3*k+2) = 3.
%p A283878 A283878:=proc(n) option remember: if n <= 0 then 0: elif n = 1 then 0: elif n = 2 then 2: elif n = 3 then 3: elif n = 4 then 1: else A283878(n-A283878(n-1)) + A283878(n-A283878(n-2)): fi: end:
%Y A283878 Cf. A005185, A188670, A244477, A264756, A283879.
%K A283878 nonn,easy
%O A283878 1,2
%A A283878 _Nathan Fox_, Mar 19 2017