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.

A329221 a(0)=0. If a(n)=k is the first occurrence of k then a(n+1)=a(k), otherwise a(n+1)=n-m where m is the index of the greatest prior term.

This page as a plain text file.
%I A329221 #28 Jul 01 2025 08:53:30
%S A329221 0,0,1,0,1,2,1,1,2,3,0,1,2,3,4,1,1,2,3,4,5,2,1,2,3,4,5,6,1,1,2,3,4,5,
%T A329221 6,7,1,1,2,3,4,5,6,7,8,2,1,2,3,4,5,6,7,8,9,3,1,2,3,4,5,6,7,8,9,10,0,1,
%U A329221 2,3,4,5,6,7,8,9,10,11,1,1,2,3,4,5,6,7,8
%N A329221 a(0)=0. If a(n)=k is the first occurrence of k then a(n+1)=a(k), otherwise a(n+1)=n-m where m is the index of the greatest prior term.
%C A329221 Subsequence a(A000217(k+1)), k>=0 is an identical copy of the original. Erasure of the first occurrence of every k does not reproduce the original so this is not a fractal sequence. However, if a(0) and the copy subsequence are both erased, what remains is A002260. Hence this sequence contains both a copy identical to the original, and a fractal subsequence different from the original.
%H A329221 Michael De Vlieger, <a href="/A329221/b329221.txt">Table of n, a(n) for n = 0..10000</a>
%H A329221 Wikipedia, <a href="https://en.wikipedia.org/wiki/Fractal_sequence">Fractal sequence</a>
%F A329221 a(k) = a(A000217(k+1)), k >= 0.
%F A329221 The n-th occurrence of k is a((k^2 + (2*n+1)*k + n*(n-1))/2), k >= 1.
%F A329221 The n-th occurrence of 0 is a(A072638(n)), n >= 0.
%e A329221 a(0)=0 is the first occurrence of the term 0, therefore a(1)=a(0+1)=a(0)=0. a(1)=0 has been seen before, and 0 is the index of the greatest prior term (0), so a(2)=a(1+1)=1-0=1.
%t A329221 Block[{a, c, j, k, m, r, nn}, nn = 120; c[_] := 0; a[0] = j = r = m = 0; Do[If[c[j] == 0, k = a[j], k = n - m - 1]; c[j]++; Set[{a[n], j}, {k, k}]; If[k > r, r = k; m = n], {n, nn}]; Array[a, nn + 1, 0] ] (* _Michael De Vlieger_, Jun 30 2025 *)
%Y A329221 Cf. A000217, A002260, A181391, A072638.
%K A329221 nonn,easy
%O A329221 0,6
%A A329221 _David James Sycamore_, Nov 22 2019