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

A364749 a(1) = 1. Thereafter, if a(n-1) is a novel term a(n) = a(a(n-1)), otherwise a(n) is the number of times a(n-1) has been repeated.

Original entry on oeis.org

1, 1, 1, 2, 1, 3, 1, 4, 2, 1, 5, 1, 6, 3, 1, 7, 1, 8, 4, 1, 9, 2, 2, 3, 2, 4, 2, 5, 1, 10, 1, 11, 5, 2, 6, 1, 12, 1, 13, 6, 2, 7, 1, 14, 3, 3, 4, 3, 5, 3, 6, 3, 7, 2, 8, 1, 15, 1, 16, 7, 3, 8, 2, 9, 1, 17, 1, 18, 8, 3, 9, 2, 10, 1, 19, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 3, 10
Offset: 1

Views

Author

David James Sycamore, Aug 05 2023

Keywords

Comments

Based on A346175, except that this sequence has offset 1, and begins a(1) = 1. When a(n-1) is a repeated term, seen k times up to and including itself, a(n) = k-1, the number of repeats of a(n-1). A record term a(m) = r beyond a(2) arises consequent to a(m-1) = 1, and is the number of times 1 has been repeated so far. The subsequence {a(r)} recovers the original sequence, which is fractal. The records subsequence is A000027.

Examples

			a(1) = 1 is a novel term, seen for the first time, so a(2) = a(a(1)) = a(1) = 1. 1 has now been repeated once so a(3) = 1. Now 1 has been repeated twice, so a(4) = 2, a novel term, meaning that a(5) = a(a(4)) = a(2) = 1.
The sequence can be represented as an irregular table wherein row n starts with the n-th record term and ends with a 1 prior to the next record term, which starts the next row. The first column of the table is the records subsequence, A000027, and the second column is a copy the sequence itself.
   1,  1, 1;
   2,  1;
   3,  1;
   4,  2, 1;
   5,  1;
   6,  3, 1;
   7,  1;
   8,  4, 1;
   9,  2, 2, 3, 2, 4, 2, 5, 1;
   10, 1;
   11, 5, 2, 6, 1;
   12, 1;
   13, 6, 2, 7, 1;
   14, 3, 3, 4, 3, 5, 3, 6,
		

Crossrefs

Programs

  • Mathematica
    a[1]=1;a[n_]:=a[n]=If[(s=Count[Array[a,n-1],a[n-1]])==1,a[a[n-1]],s-1];
    Array[a,100] (* Giorgos Kalogeropoulos, Aug 07 2023 *)

Extensions

More terms from Giorgos Kalogeropoulos, Aug 07 2023

A383876 a(0) = 0, a(1) = 1. Let n be greatest index such that a(0),...a(n) are already known. If a(n) is not a record term, a(n+1) = number of k < n such that a(k) = a(n). If a(n) is a record term a(n+1) = a(r) where r is the greatest record < a(n).

Original entry on oeis.org

0, 1, 0, 1, 1, 2, 1, 3, 0, 2, 1, 4, 1, 5, 1, 6, 2, 2, 3, 1, 7, 1, 8, 3, 2, 4, 1, 9, 0, 3, 3, 4, 2, 5, 1, 10, 2, 6, 1, 11, 1, 12, 4, 3, 5, 2, 7, 1, 13, 1, 14, 5, 3, 6, 2, 8, 1, 15, 1, 16, 6, 3, 7, 2, 9, 1, 17, 2, 10, 1, 18, 2, 11, 1, 19, 3, 8, 2, 12, 1, 20, 1, 21
Offset: 0

Views

Author

David James Sycamore, May 13 2025

Keywords

Comments

After a(5) = 2 a record term produces a string of familiar terms leading to the next record, whereupon the process repeats (see Example). Since each record term increments its predecessor by +1, the records subsequence is A001477. If the first condition in Name is replaced by the "count back" function of A181391 the result is A025480 (n >= 1). The proper subsequence a(r), r a record = 0,1,2,3,..... is identical to the original, therefore the sequence contains infinitely many proper copies of itself. Every nonnegative integer appears infinitely many times.

Examples

			a(1) = 1 is a record term so a(2) = a(0) = 0 since 0 is the greatest record prior to 1. a(2) = 0, which has been seen once already so a(3) = 1, which has also been seen once already so a(4) = 1. Now there are two prior terms = 1, so a(5) = 2, and since this is a new record, a(6) = a(1) since 1 is the greatest record prior to 2. Therefore a(6) = 1. Now 1 has occurred 3 times prior to a(6) so a(7) = 3. The number of repeat terms between consecutive records varies, starting: 0,3,1,3,1,1..
		

Crossrefs

Programs

  • Mathematica
    nn = 10000; c[_] := 0; z = a[0] = 0; c[0]++; r = a[1] = 1; q = True;
    Do[If[q, k = a[z], k = c[a[n - 1]]];
      c[a[n - 1]]++; Set[{a[n], q}, {k, False}];
      If[k > r, Set[{z, r, q}, {r, k, True}] ], {n, 2, nn}];
    Array[a, nn + 1, 0] (* Michael De Vlieger, May 14 2025 *)
Showing 1-2 of 2 results.