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.

A364784 a(n) = n for n <= 2. Thereafter if a(n-1) is a novel term, a(n) = a(a(k)) where k is the greatest prior term < a(n-1); otherwise, a(n) = number of times a(n-1) has been repeated.

This page as a plain text file.
%I A364784 #26 Jun 21 2025 01:56:54
%S A364784 1,2,1,1,2,1,3,2,2,3,1,4,1,5,1,6,2,4,1,7,1,8,3,2,5,1,9,2,6,1,10,2,7,1,
%T A364784 11,3,3,4,2,8,1,12,1,13,4,3,5,2,9,1,14,1,15,5,3,6,2,10,1,16,1,17,6,3,
%U A364784 7,2,11,1,18,2,12,1,19,4,4,5,4,6,4,7,3,8,2
%N A364784 a(n) = n for n <= 2. Thereafter if a(n-1) is a novel term, a(n) = a(a(k)) where k is the greatest prior term < a(n-1); otherwise, a(n) = number of times a(n-1) has been repeated.
%C A364784 The definition is similar to that of A364749.
%C A364784 With the exception of a(3) = a(4) = 1, every term a(r-1) = 1 occurs prior to record term a(r), and a(r) is the number of times 1 has been repeated so far.
%C A364784 The subsequence of records is A000027, and the subsequence {a(r)} is a copy of the sequence itself, which is fractal (see Example).
%H A364784 Michael De Vlieger, <a href="/A364784/b364784.txt">Table of n, a(n) for n = 1..10000</a>
%H A364784 Michael De Vlieger, <a href="/A364784/a364784.png">Log log scatterplot of a(n)</a>, n = 1..2^16.
%e A364784 The given terms are a(1) = 1 and a(2) = 2. Since 2 is a novel term and 1 is the greatest prior term < 2, a(3) = a(1) = 1, and since a(3) is the second occurrence of 1, a(4) = 1 (the number of times 1 has been repeated). Now 1 has occurred 3 times so a(5) = 2, and so on.
%e A364784 The sequence can be represented as an irregular table in which the n-th row starts with the n-th record, and ends with the term = 1 which precedes the next record. Thus the first column is A000027, and the second column is the sequence itself.
%e A364784 The table begins:
%e A364784   1;
%e A364784   2,1,1,2,1;
%e A364784   3,2,2,3,1;
%e A364784   4,1;
%e A364784   5,1;
%e A364784   6,2,4,1;
%e A364784   7,1;
%e A364784   8,3,2,5,1;
%e A364784   9,2,6,1;
%e A364784   10,2,7,1;
%e A364784   11,3,3,4,2,8,1;
%e A364784   12,1;
%e A364784   13,4,3,5,2,9,1;
%t A364784 nn = 1000; c[_] = 0; Array[Set[a[#], #] &, 2]; c[1] = 1; Do[a[n] = If[c[#] == 0, c[#]++; k = # - 1; While[c[k] == 0, k--]; a[k], c[#]; c[#]++] &@ a[n - 1], {n, 3, nn}]; Array[a, nn] (* _Michael De Vlieger_, Aug 07 2023 *)
%Y A364784 Cf. A000027, A364749.
%K A364784 nonn,tabf
%O A364784 1,2
%A A364784 _David James Sycamore_, Aug 07 2023
%E A364784 More terms from _Michael De Vlieger_, Aug 07 2023