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.

Showing 1-10 of 10 results.

A264757 An eventually quasi-quadratic solution to Hofstadter's Q recurrence.

Original entry on oeis.org

4, 0, 5, 6, 2, 6, 6, 3, 11, 6, 2, 12, 6, 3, 23, 6, 2, 18, 6, 3, 41, 6, 2, 24, 6, 3, 65, 6, 2, 30, 6, 3, 95, 6, 2, 36, 6, 3, 131, 6, 2, 42, 6, 3, 173, 6, 2, 48, 6, 3, 221, 6, 2, 54, 6, 3, 275, 6, 2, 60, 6, 3, 335, 6, 2, 66, 6, 3, 401, 6, 2, 72, 6, 3, 473, 6
Offset: 1

Views

Author

Nathan Fox, Nov 23 2015

Keywords

Comments

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) = 4, a(2) = 0, a(3) = 5, a(4) = 6, a(5) = 2, a(6) = 6, a(7) = 6, a(8) = 3.

Crossrefs

Programs

  • Mathematica
    Table[If[n < 3, # - n - 1, #] &@ Switch[Mod[n, 6], 0, n, 1, 6, 2, 3, 3, 3 #^2 + 3 # + 5 &[(n - 3)/6], 4, 6, 5, 2], {n, 75}] (* or *)
    Rest@ CoefficientList[Series[x (4 + 5 x^2 + 6 x^3 + 2 x^4 + 6 x^5 - 6 x^6 + 3 x^7 - 4 x^8 - 12 x^9 - 4 x^10 - 6 x^11 - 6 x^13 + 5 x^14 + 6 x^15 + 2 x^16 + 2 x^18 + 3 x^19)/((1 - x)^3*(1 + x)^3*(1 - x + x^2)^3*(1 + x + x^2)^3), {x, 0, 76}], x] (* Michael De Vlieger, Nov 14 2016 *)
  • PARI
    Vec(x*(4+5*x^2+6*x^3+2*x^4+6*x^5-6*x^6+3*x^7-4*x^8-12*x^9-4*x^10-6*x^11-6*x^13+5*x^14+6*x^15+2*x^16+2*x^18+3*x^19)/((1-x)^3*(1+x)^3*(1-x+x^2)^3*(1+x+x^2)^3) + O(x^100)) \\ Colin Barker, Nov 14 2016

Formula

a(1) = 4, a(2) = 0; thereafter a(6*n) = 6*n, a(6*n+1) = 6, a(6*n+2) = 3, a(6*n+3) = 3*n^2+3*n+5, a(6*n+4) = 6, a(6*n+5) = 2.
From Colin Barker, Nov 14 2016: (Start)
G.f.: x*(4 + 5*x^2 + 6*x^3 + 2*x^4 + 6*x^5 - 6*x^6 + 3*x^7 - 4*x^8 - 12*x^9 - 4*x^10 - 6*x^11 - 6*x^13 + 5*x^14 + 6*x^15 + 2*x^16 + 2*x^18 + 3*x^19) / ((1 - x)^3 * (1 + x)^3 * (1 - x + x^2)^3 * (1 + x + x^2)^3).
a(n) = 3*a(n-6) - 3*a(n-12) + a(n-18) for n>20.
(End)

A264758 An eventually quasi-cubic solution to Hofstadter's Q recurrence.

Original entry on oeis.org

7, 0, 5, 9, 3, 8, 9, 2, 9, 9, 3, 14, 9, 3, 22, 9, 2, 18, 9, 3, 32, 9, 3, 54, 9, 2, 27, 9, 3, 59, 9, 3, 113, 9, 2, 36, 9, 3, 95, 9, 3, 208, 9, 2, 45, 9, 3, 140, 9, 3, 348, 9, 2, 54, 9, 3, 194, 9, 3, 542, 9, 2, 63, 9, 3, 257, 9, 3, 799, 9, 2, 72, 9, 3, 329, 9
Offset: 1

Views

Author

Nathan Fox, Nov 23 2015

Keywords

Comments

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) = 7, a(2) = 0, a(3) = 5, a(4) = 9, a(5) = 3, a(6) = 8, a(7) = 9, a(8) = 2, a(9) = 9, a(10) = 9, a(11) = 3.

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[x (7+5x^2+9x^3+3x^4+8x^5+9x^6+2x^7+9x^8- 19x^9+ 3x^10- 6x^11- 27x^12-9x^13- 10x^14- 27x^15-6x^16-18x^17+ 15x^18- 9x^19+6x^20+ 27x^21+9x^22+14x^23+ 27x^24+ 6x^25+ 9x^26-x^27+9x^28- 5x^29-9x^30-3x^31- 3x^32-9x^33-2x^34- 2x^36-3x^37)/((1-x)^4(1+x+x^2)^4 (1+x^3+x^6)^4),{x,0,100}],x] (* Harvey P. Dale, Aug 14 2021 *)
  • PARI
    a = [7,0,5,9,3,8,9,2]; for(n=1, 10, a=concat(a, [9*n, 9, 3, 9/2*n^2+9/2*n+5, 9, 3, 3/2*n^3+9/2*n^2+8*n+8, 9, 2])); a

Formula

a(1) = 7, a(2) = 0; thereafter a(9*n) = 9*n, a(9*n+1) = 9, a(9*n+2) = 3, a(9*n+3) = 9/2*n^2+9/2*n+5, a(9*n+4) = 9, a(9*n+5) = 3, a(9*n+6) = 3/2*n^3+9/2*n^2+8*n+8, a(9*n+7) = 9, a(9*n+8) = 2.
From Colin Barker, Nov 14 2016: (Start)
G.f.: x*(7 +5*x^2 +9*x^3 +3*x^4 +8*x^5 +9*x^6 +2*x^7 +9*x^8 -19*x^9 +3*x^10 -6*x^11 -27*x^12 -9*x^13 -10*x^14 -27*x^15 -6*x^16 -18*x^17 +15*x^18 -9*x^19 +6*x^20 +27*x^21 +9*x^22 +14*x^23 +27*x^24 +6*x^25 +9*x^26 -x^27 +9*x^28 -5*x^29 -9*x^30 -3*x^31 -3*x^32 -9*x^33 -2*x^34 -2*x^36 -3*x^37) / ((1 -x)^4*(1 +x +x^2)^4*(1 +x^3 +x^6)^4).
a(n) = 4*a(n-9) - 6*a(n-18) + 4*a(n-27) - a(n-36) for n>38.
(End)

A275153 A linear-recurrent solution to Hofstadter's Q-recurrence.

Original entry on oeis.org

9, 0, 0, 0, 7, 9, 9, 10, 4, 9, 9, 3, 9, 16, 9, 9, 20, 4, 9, 18, 3, 9, 34, 9, 9, 40, 4, 9, 27, 3, 9, 61, 9, 9, 80, 4, 9, 36, 3, 9, 97, 9, 9, 160, 4, 9, 45, 3, 9, 142, 9, 9, 320, 4, 9, 54, 3, 9, 196, 9, 9, 640, 4, 9, 63, 3, 9, 259, 9, 9, 1280, 4, 9, 72, 3, 9, 331, 9, 9, 2560
Offset: 1

Views

Author

Nathan Fox, Jul 17 2016

Keywords

Comments

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) = 9, a(2) = 0, a(3) = 0, a(4) = 0, a(5) = 7, a(6) = 9, a(7) = 9, a(8) = 10, a(9) = 4, a(10) = 9, a(11) = 9, a(12) = 3.
This sequence is an interleaving of nine simpler sequences. Six are eventually constant, one is a linear polynomial, one is a quadratic polynomial, and one is a geometric sequence.

Crossrefs

Programs

  • Mathematica
    Join[{9, 0, 0, 0}, LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, -9, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, -2}, {7, 9, 9, 10, 4, 9, 9, 3, 9, 16, 9, 9, 20, 4, 9, 18, 3, 9, 34, 9, 9, 40, 4, 9, 27, 3, 9, 61, 9, 9, 80, 4, 9, 36, 3, 9}, 100]] (* Jean-François Alcover, Dec 01 2018 *)

Formula

a(3) = 0, a(4) = 0; otherwise:
a(9n) = 4, a(9n+1) = 9 a(9n+2) = 9n a(9n+3) = 3.
a(9n+4) = 9, a(9n+5) = (9*n^2 + 9*n + 14)/2, a(9n+6) = 9.
a(9n+7) = 9, a(9n+8) = 10*2^n.
a(n) = 5*a(n-9) - 9*a(n-18) + 7*a(n-27) - 2*a(n-36) for n>40.
G.f.: -(18*x^39 +6*x^38 +8*x^35 +10*x^34 +18*x^33 +18*x^32 +14*x^31 -45*x^30 -15*x^29 -18*x^28 +18*x^27 -20*x^26 -30*x^25 -45*x^24 -45*x^23 -17*x^22 +36*x^21 +12*x^20 +27*x^19 -45*x^18 +16*x^17 +30*x^16 +36*x^15 +36*x^14 +19*x^13 -9*x^12 -3*x^11 -9*x^10 +36*x^9 -4*x^8 -10*x^7 -9*x^6 -9*x^5 -7*x^4 -9)/((2*x^9-1)*(x-1)^3*(x^2+x+1)^3*(x^6+x^3+1)^3).

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

Original entry on oeis.org

5, 2, 0, 3, 6, 5, 2, 5, 5, 12, 5, 2, 10, 5, 18, 5, 2, 15, 5, 24, 5, 2, 20, 5, 30, 5, 2, 25, 5, 36, 5, 2, 30, 5, 42, 5, 2, 35, 5, 48, 5, 2, 40, 5, 54, 5, 2, 45, 5, 60, 5, 2, 50, 5, 66, 5, 2, 55, 5, 72, 5, 2, 60, 5, 78, 5, 2, 65, 5, 84, 5, 2, 70, 5, 90
Offset: 1

Views

Author

Nathan Fox, Feb 23 2016

Keywords

Comments

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) = 5, a(2) = 2, a(3) = 0, a(4) = 3, a(5) = 6, a(6) = 5, a(7) = 2.
Starting from n=5, this sequence consists of five interleaved linear sequences with three different slopes.
Square array read by rows: T(j,k), j>=1, 1<=k<=5, in which row j list [5, 2, 5*(j-1), 5, 6*j], except T(1,4) = 3, not 5. - Omar E. Pol, Jun 22 2016

Examples

			From _Omar E. Pol_, Jun 22 2016: (Start)
Written as a square array T(j,k) with five columns the sequence begins:
5, 2,  0, 3,  6;
5, 2,  5, 5, 12;
5, 2, 10, 5, 18;
5, 2, 15, 5, 24;
5, 2, 20, 5, 30;
5, 2, 25, 5, 36;
5, 2, 30, 5, 42;
5, 2, 35, 5, 48;
5, 2, 40, 5, 54;
5, 2, 45, 5, 60;
5, 2, 50, 5, 66;
5, 2, 55, 5, 72;
5, 2, 60, 5, 78;
5, 2, 65, 5, 84;
5, 2, 70, 5, 90;
...
Note that T(1,4) = 3, not 5. (End)
		

Crossrefs

Programs

  • Magma
    I:=[5,2,0,3,6,5,2,5,5,12,5,2,10,5]; [n le 14 select I[n] else 2*Self(n-5)-Self(n-10): n in [1..100]]; // Vincenzo Librandi, Dec 16 2018
  • Mathematica
    Join[{5, 2, 0, 3}, LinearRecurrence[{0, 0, 0, 0, 2, 0, 0, 0, 0, -1} , {6, 5, 2, 5, 5, 12, 5, 2, 10, 5}, 80]] (* Jean-François Alcover, Dec 16 2018 *)
    CoefficientList[Series[(-2 x^13 - x^8 + 5 x^7 - 2 x^6 - 5 x^5 + 6 x^4 + 3 x^3 + 2 x + 5) / (x^10 - 2 x^5 + 1), {x, 0, 100}], x] (* Vincenzo Librandi, Dec 16 2018 *)

Formula

a(4) = 3; otherwise a(5n) = 6n, a(5n+1) = 5, a(5n+2) = 2, a(5n+3) = 5n, a(5n+4) = 5.
From Chai Wah Wu, Jun 22 2016: (Start)
a(n) = 2*a(n-5) - a(n-10) for n > 14.
G.f.: x*(-2*x^13 - x^8 + 5*x^7 - 2*x^6 - 5*x^5 + 6*x^4 + 3*x^3 + 2*x + 5)/(x^10 - 2*x^5 + 1). (End)

A275361 An eventually quasilinear solution to Hofstadter's Q-recurrence.

Original entry on oeis.org

0, 4, -40, -9, 8, -8, 7, 1, 5, 13, -24, -1, 8, 8, 8, 1, 5, 13, -8, 7, 8, 8, 23, 1, 5, 13, 8, 15, 8, 16, 31, 1, 5, 13, 24, 23, 8, 24, 39, 1, 5, 13, 40, 31, 8, 32, 47, 1, 5, 13, 56, 39, 8, 40, 55, 1, 5, 13, 72, 47, 8, 48, 63, 1, 5, 13, 88, 55, 8, 56, 71
Offset: 1

Views

Author

Nathan Fox, Jul 24 2016

Keywords

Comments

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 first 45 terms as initial conditions.
This is a quasilinear sequence with quasiperiod 8. Four of the component sequences are constant, three have slope 1, and one has slope 2.

Crossrefs

Programs

  • Mathematica
    Join[{0, 4, -40, -9, 8, -8, 7, 1, 5, 13, -24, -1, 8, 8, 8}, LinearRecurrence[ {0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, -1}, {1, 5, 13, -8, 7, 8, 8, 23, 1, 5, 13, 8, 15, 8, 16, 31}, 100]] (* Jean-François Alcover, Dec 12 2018 *)

Formula

a(1) = 0, a(2) = 4, a(14) = 8, a(15) = 8; otherwise:
a(8n) = 1, a(8n+1) = 5, a(8n+2) = 13, a(8n+3) = 16n-40, a(8n+4) = 8n-9, a(8n+5) = 8, a(8n+6) = 8n-8, a(8n+7) = 8n+7.
a(n) = 2*a(n-8) - a(n-16) for n>31.
G.f.: -(7*x^30 -8*x^29 -14*x^22 +16*x^21 +9*x^17 +5*x^16 +x^15 +6*x^14 -24*x^13 +8*x^12 -17*x^11 -56*x^10 -5*x^9 -5*x^8 -x^7 -7*x^6 +8*x^5 -8*x^4 +9*x^3 +40*x^2 -4*x)/((x-1)^2*(x+1)^2*(x^2+1)^2*(x^4+1)^2).

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

Original entry on oeis.org

-9, 2, 9, 2, 0, 7, 9, 10, 3, 0, 2, 9, 2, 9, 9, 9, 20, 3, 9, 22, 9, 2, 18, 9, 18, 30, 3, 18, 32, 9, 2, 27, 9, 27, 40, 3, 27, 42, 9, 2, 36, 9, 36, 50, 3, 36, 52, 9, 2, 45, 9, 45, 60, 3, 45, 62, 9, 2, 54, 9, 54, 70, 3, 54, 72, 9, 2, 63, 9, 63, 80, 3, 63, 82
Offset: 1

Views

Author

Nathan Fox, Jul 24 2016

Keywords

Comments

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) = -9, a(2) = 2, a(3) = 9, a(4) = 2, a(5) = 0, a(6) = 7, a(7) = 9, a(8) = 10, a(9) = 3, a(10) = 0, a(11) = 2, a(12) = 9, a(13) = 2, a(14) = 9, a(15) = 9, a(16) = 9.
This is a quasilinear sequence with quasiperiod 9. Four of the component sequences are constant, three have slope 1, and two have slope 10/9.

Crossrefs

Programs

  • Mathematica
    Join[{-9, 2, 9, 2, 0, 7, 9, 10, 3, 0, 2}, LinearRecurrence[{0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, -1}, {9, 2, 9, 9, 9, 20, 3, 9, 22, 9, 2, 18, 9, 18, 30, 3, 18, 32}, 100]] (* Jean-François Alcover, Dec 13 2018 *)

Formula

a(6) = 7, a(7) = 9, a(11) = 2; otherwise:
a(9n) = 3, a(9n+1) = 9n-9, a(9n+2) = 10n+2, a(9n+3) = 9, a(9n+4) = 2, a(9n+5) = 9n, a(9n+6) = 9, a(9n+7) = 9n, a(9n+8) = 10n+10.
a(n) = 2*a(n-9) - a(n-18) for n>29.
G.f.: -(10*x^28 -9*x^24 +2*x^23 -20*x^19 +3*x^17 +9*x^15 +5*x^14 -9*x^13 +2*x^12 +9*x^11 +2*x^10 -18*x^9 -3*x^8 -10*x^7 -9*x^6 -7*x^5 -2*x^3 -9*x^2 -2*x+9)/((x-1)^2*(x^2+x+1)^2*(x^6+x^3+1)^2).

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

Original entry on oeis.org

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, 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, 1, 3, 63, 1, 3, 66, 1, 3, 69, 1, 3, 72, 1, 3, 75
Offset: 1

Views

Author

Nathan Fox, Mar 19 2017

Keywords

Comments

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.

Crossrefs

Programs

  • Maple
    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:

Formula

G.f.: (-x*(x^6 + x^5 + x^3 - x^2 - 3*x - 2)) / ((-1 + x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6) for n > 8.
a(1) = 0, a(2) = 2; thereafter a(3*k) = 3*k, a(3*k+1) = 1, a(3*k+2) = 3.

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

Original entry on oeis.org

4, 1, 0, 3, 3, 1, 4, 8, 7, 1, 4, 12, 11, 1, 4, 16, 15, 1, 4, 20, 19, 1, 4, 24, 23, 1, 4, 28, 27, 1, 4, 32, 31, 1, 4, 36, 35, 1, 4, 40, 39, 1, 4, 44, 43, 1, 4, 48, 47, 1, 4, 52, 51, 1, 4, 56, 55, 1, 4, 60, 59, 1, 4, 64, 63, 1, 4, 68, 67, 1, 4, 72, 71, 1, 4
Offset: 1

Views

Author

Nathan Fox, Mar 19 2017

Keywords

Comments

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) = 4, a(2) = 1, a(3) = 0, a(4) = 3, a(5) = 3, a(6) = 1, a(7) = 4, a(8) = 8.

Crossrefs

Programs

  • Maple
    A283879:=proc(n) option remember: if n <= 0 then 0: elif n = 1 then 4: elif n = 2 then 1: elif n = 3 then 0: elif n = 4 then 3: elif n = 5 then 3: elif n = 6 then 1: elif n = 7 then 4: elif n = 8 then 8: else A283879(n-A283879(n-1)) + A283879(n-A283879(n-2)): fi: end:
  • Mathematica
    LinearRecurrence[{1,-1,1,1,-1,1,-1},{4,1,0,3,3,1,4,8,7,1,4},80] (* Harvey P. Dale, May 25 2025 *)

Formula

a(1) = 4, a(4) = 3; otherwise a(4n) = 4n, a(4n+1) = 4n-1, a(4n+2) = 1, a(4n+3) = 4.
G.f.: (-x^10-3*x^9+3*x^8+2*x^7+4*x^5-5*x^4+3*x^2-3*x+4) / ((1+x)*(-1+x)^2*(1+x^2)^2).
a(n) = a(n-1) - a(n-2) + a(n-3) + a(n-4) - a(n-5) + a(n-6) - a(n-7) for n > 11.

A275365 a(1)=2, a(2)=2; thereafter a(n) = a(n-a(n-1)) + a(n-a(n-2)).

Original entry on oeis.org

0, 2, 2, 4, 2, 6, 2, 8, 2, 10, 2, 12, 2, 14, 2, 16, 2, 18, 2, 20, 2, 22, 2, 24, 2, 26, 2, 28, 2, 30, 2, 32, 2, 34, 2, 36, 2, 38, 2, 40, 2, 42, 2, 44, 2, 46, 2, 48, 2, 50, 2, 52, 2, 54, 2, 56, 2, 58, 2, 60, 2, 62, 2, 64, 2, 66, 2, 68, 2, 70, 2, 72, 2, 74
Offset: 0

Views

Author

Nathan Fox, Jul 24 2016

Keywords

Comments

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) = 2, a(2) = 2.
Starting with n=1, a(n) is A005843 interleaved with A007395.
This sequence is the same as A133265 with the leading 2 changed to a 0.

Crossrefs

Programs

  • Mathematica
    Join[{0}, LinearRecurrence[{0, 2, 0, -1}, {2, 2, 4, 2}, 73]] (* Jean-François Alcover, Feb 19 2019 *)

Formula

a(0) = 0; thereafter, a(2n) = 2, a(2n+1) = 2n+2.
a(n) = 2*a(n-2) - a(n-4) for n>4.
G.f.: -(2*x^3 -2*x -2)/((x-1)^2*(x+1)^2).

A284429 A quasilinear solution to Hofstadter's Q recurrence.

Original entry on oeis.org

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, 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, 3, 62, 1, 3, 65, 1, 3, 68, 1, 3, 71, 1, 3, 74, 1, 3
Offset: 1

Views

Author

Nathan Fox, Mar 26 2017

Keywords

Comments

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.
This sequence is a close relative of A283878.

Crossrefs

Programs

  • Maple
    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:
  • Mathematica
    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 *)
  • 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

Formula

G.f.: (-3*x^5 - x^4 + x^3 + 3*x^2 + x + 2) / ((-1 + x)^2*(1 + x + x^2)^2).
a(n) = 2*a(n-3) - a(n-6) for n > 6.
a(3*k) = 3,
a(3*k+1) = 3*k+2,
a(3*k+2) = 1.
Showing 1-10 of 10 results.