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-6 of 6 results.

A064714 Define q(0)=1, q(1)=1, q(2)=1, q(n)=q(abs(n-q(n-2)))+q(abs(n-q(n-3))) (A063892); then a(0) = 1, a(n)=a(n-1)+2*(q(n)-n/2), n > 0.

Original entry on oeis.org

1, 2, 2, 3, 7, 14, 18, 17, 15, 24, 26, 23, 25, 36, 40, 35, 33, 36, 50, 63, 63, 66, 68, 77, 81, 98, 98, 105, 93, 92, 110, 131, 137, 128, 110, 121, 129, 138, 124, 119, 115, 130, 158, 167, 155, 154, 176, 223, 219, 182, 152, 173, 259, 278, 266, 261, 271, 296, 304, 303
Offset: 0

Views

Author

Robert G. Wilson v, Oct 13 2001

Keywords

Crossrefs

Programs

  • Mathematica
    a[0] = q[0] = q[1] = q[2] = 1; q[n_] := q[n] = q[Abs[n - q[n - 2]]] + q[Abs[n - q[n - 3]]]; a[n_] := a[n] = a[n - 1] + 2*(q[n] - n/2); Table[a[n], {n, 0, 70} ]

A063882 a(n) = a(n - a(n - 1)) + a(n - a(n - 4)), with a(1) = ... = a(4) = 1.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 4, 5, 5, 6, 6, 7, 8, 8, 9, 9, 10, 11, 11, 11, 12, 12, 13, 14, 14, 15, 15, 16, 17, 17, 17, 18, 18, 19, 20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 25, 25, 26, 26, 27, 27, 28, 29, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 34, 34, 35, 35, 36, 37, 37, 38, 38, 39, 39, 40
Offset: 1

Views

Author

Theodor Schlickmann (Theodor.Schlickmann(AT)cec.eu.int), Aug 28 2001

Keywords

Comments

A captivating recursive function. A meta-Fibonacci recursion.
This has been completely analyzed by Balamohan et al. They prove that the sequence a(n) is monotonic, with successive terms increasing by 0 or 1, so the sequence hits every positive integer.
They demonstrate certain special structural properties and periodicities of the associated frequency sequence (the number of times a(n) hits each positive integer) that make possible an iterative computation of a(n) for any value of n.
Further, they derive a natural partition of the a-sequence into blocks of consecutive terms ("generations") with the property that terms in one block determine the terms in the next.
a(A202014(n)) = n and a(m) < n for m < A202014(n). [Reinhard Zumkeller, Dec 08 2011]

Crossrefs

Cf. A132157. For partial sums see A129632.
A136036(n) = a(n+1) - a(n).
Cf. A202016 (occur only once).

Programs

  • Haskell
    a063882 n = a063882_list !! (n-1)
    a063882_list = 1 : 1 : 1 : 1 : zipWith (+)
       (map a063882 $ zipWith (-) [5..] a063882_list)
       (map a063882 $ zipWith (-) [5..] $ drop 3 a063882_list)
    -- Reinhard Zumkeller, Dec 08 2011
  • Maple
    a := proc(n) option remember; if n<=4 then 1 else if n > a(n-1) and n > a(n-4) then RETURN(a(n-a(n-1))+a(n-a(n-4))); else ERROR(" died at n= ", n); fi; fi; end;
  • Mathematica
    a[1]=a[2]=a[3]=a[4]=1;a[n_]:=a[n]=a[n-a[n-1]]+a[n-a[n-4]];Table[a[n],{n,80}]

Formula

n/2 < a(n) <= n/2 + log_2 (n) - 1 for all n > 6 [Balamohan et al., Proposition 5].

Extensions

Edited by N. J. A. Sloane, Nov 06 2007
Mathematica program corrected by Harvey P. Dale, Jan 24 2025

A226222 a(1) = a(2) = a(3) = 1, a(n) = a(n-2-a(n-2)) + a(n-1-a(n-3)) for n>3.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 3, 4, 5, 5, 5, 6, 6, 7, 7, 8, 9, 9, 9, 10, 10, 11, 11, 11, 12, 13, 13, 13, 14, 15, 16, 16, 16, 17, 18, 18, 18, 18, 19, 20, 21, 21, 21, 21, 22, 22, 23, 23, 24, 25, 25, 25, 26, 26, 27, 27, 28, 29, 30, 30, 30, 31, 32, 32, 32, 32, 33, 35, 35
Offset: 1

Views

Author

Reinhard Zumkeller, May 31 2013

Keywords

Comments

First numbers not occurring: 62, 66, 75, 79, 114, 123, ... .

Crossrefs

Programs

  • Haskell
    a226222 n = a226222_list !! (n-1)
    a226222_list = 1 : 1 : 1 : zipWith (+)
       (map a226222 $ zipWith (-) [3..] a226222_list)
       (map a226222 $ zipWith (-) [2..] $ tail a226222_list)
    -- Reinhard Zumkeller, May 31 2013
    
  • Mathematica
    a[n_]:= a[n]= If[n<4, 1, a[n-2 -a[n-2]] + a[n-1 -a[n-3]]];
    Table[a[n], {n, 80}] (* G. C. Greubel, Mar 28 2022 *)
  • Sage
    @CachedFunction
    def a(n): # A226222
        if (n<4): return 1
        else: return  a(n-2-a(n-2)) + a(n-1-a(n-3))
    [a(n) for n in (1..80)] # G. C. Greubel, Mar 28 2022

Formula

a(n) = a(n-2 - a(n-2)) + a(n-1 - a(n-3)), with a(1) = a(2) = a(3) = 1.

A309492 a(1) = a(2) = 1, a(3) = 3, a(4) = 5, a(5) = 2; a(n) = a(n-a(n-2)) + a(n-a(n-3)) for n > 5.

Original entry on oeis.org

1, 1, 3, 5, 2, 4, 3, 9, 6, 4, 3, 13, 10, 4, 3, 17, 14, 4, 3, 21, 18, 4, 3, 25, 22, 4, 3, 29, 26, 4, 3, 33, 30, 4, 3, 37, 34, 4, 3, 41, 38, 4, 3, 45, 42, 4, 3, 49, 46, 4, 3, 53, 50, 4, 3, 57, 54, 4, 3, 61, 58, 4, 3, 65, 62, 4, 3, 69, 66, 4, 3, 73, 70, 4, 3, 77, 74, 4, 3, 81, 78, 4, 3, 85, 82, 4, 3
Offset: 1

Views

Author

Altug Alkan, Aug 04 2019

Keywords

Comments

A well-defined solution sequence for recurrence a(n) = a(n-a(n-2)) + a(n-a(n-3)).

Crossrefs

Programs

  • Magma
    I:=[1,1,3,5,2];[n le 5 select I[n] else Self(n-Self(n-2))+Self(n-Self(n-3)): n in [1..90]]; // Marius A. Burtea, Aug 07 2019
  • Mathematica
    a[n_] := a[n] = If[n < 6, {1, 1, 3, 5, 2}[[n]], a[n - a[n-2]] + a[n - a[n-3]]]; Array[a, 87] (* Giovanni Resta, Aug 07 2019 *)
  • PARI
    q=vector(100); q[1]=1;q[2]=1;q[3]=3;q[4]=5;q[5]=2; for(n=6, #q, q[n]=q[n-q[n-2]]+q[n-q[n-3]]); q
    
  • PARI
    Vec(x*(1 + 3*x^2 + 2*x^3 - 2*x^4 + 4*x^5 - 7*x^6 + 6*x^7 - 3*x^8) / ((1 - x)^2*(1 + x)*(1 + x^2)^2) + O(x^40)) \\ Colin Barker, Aug 15 2019
    

Formula

For k > 2:
a(4*k) = 4*k+1,
a(4*k+1) = 4*k-2,
a(4*k+2) = 4,
a(4*k+3) = 3.
From Colin Barker, Aug 04 2019: (Start)
G.f.: x*(1 + 3*x^2 + 2*x^3 - 2*x^4 + 4*x^5 - 7*x^6 + 6*x^7 - 3*x^8) / ((1 - x)^2*(1 + x)*(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 > 9.
(End)

A240811 a(n) = length (or lifetime) of the meta-Fibonacci sequence f(1) = ... = f(n) = 1; f(k)=f(k-f(k-2))+f(k-f(k-n)) if that sequence is only defined for finitely many terms, or 0 if that sequence is infinite.

Original entry on oeis.org

14, 54, 0, 37, 30, 63, 368, 47, 46, 108, 188, 118, 62, 209, 126, 197, 78, 127, 190, 141, 94, 130, 138, 226, 110, 134, 158, 138, 126, 170, 242, 371, 142, 190, 178, 225, 158, 206, 214, 304, 174, 226, 238, 245, 190, 250, 262, 328, 206, 234, 278, 357, 222, 290
Offset: 2

Views

Author

N. J. A. Sloane, Apr 15 2014

Keywords

Comments

The term a(4) = 0 is only conjectural.

References

  • D. R. Hofstadter, Curious patterns and non-patterns in a family of meta-Fibonacci recursions, Lecture in Doron Zeilberger's Experimental Mathematics Seminar, Rutgers University, April 10 2014.

Crossrefs

Cf. A063892, A087777, A240817 (sequences for n=3..5).
See A240814 for another version.
A diagonal of the triangle in A240813.

Extensions

More terms from Lars Blomberg, Oct 24 2014

A309650 a(1) = 3, a(2) = 1, a(3) = 4, a(4) = 2; a(n) = a(n-a(n-2)) + a(n-a(n-3)) for n > 4.

Original entry on oeis.org

3, 1, 4, 2, 5, 3, 6, 9, 7, 5, 3, 11, 14, 7, 5, 8, 16, 19, 7, 5, 8, 21, 24, 12, 5, 8, 26, 29, 12, 5, 8, 31, 34, 12, 5, 13, 36, 39, 12, 5, 13, 41, 44, 12, 5, 13, 46, 49, 17, 5, 13, 51, 54, 17, 5, 13, 56, 59, 17, 5, 13, 61, 64, 17, 5, 18, 66, 69, 17, 5, 18, 71, 74, 17, 5, 18, 76, 79, 17, 5, 18, 81, 84, 22, 5
Offset: 1

Views

Author

Altug Alkan and Nathan Fox, Aug 11 2019

Keywords

Comments

A well-defined quasi-periodic solution for recurrence (a(n) = a(n-a(n-2)) + a(n-a(n-3))).

Crossrefs

Programs

  • Magma
    I:=[3,1,4,2]; [n le 4 select I[n] else  Self(n-Self(n-2)) + Self(n-Self(n-3)): n in [1..90]]; // Marius A. Burtea, Aug 11 2019
  • Mathematica
    Nest[Append[#, #[[-#[[-2]] ]] + #[[-#[[-3]] ]]] &, {3, 1, 4, 2}, 81] (* Michael De Vlieger, May 08 2020 *)
  • PARI
    q=vector(100); q[1]=3; q[2]=1; q[3]=4; q[4]=2; for(n=5, #q, q[n] = q[n-q[n-2]] + q[n-q[n-3]]); q
    

Formula

For k >= 1:
a(5*k) = 5,
a(5*k+1) = 5*floor(sqrt(k)+1/2)-2,
a(5*k+2) = 5*k+1,
a(5*k+3) = 5*k+4,
a(5*k+4) = 5*floor(sqrt(k))+2.
Showing 1-6 of 6 results.