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.
%I A327883 #66 Jun 25 2025 20:52:59 %S A327883 0,0,0,1,0,2,0,4,1,3,0,6,2,5,0,10,3,9,1,8,4,7,0,14,5,13,2,12,6,11,0, %T A327883 22,7,21,4,20,8,19,1,18,9,17,3,16,10,15,0,30,11,29,6,28,12,27,2,26,13, %U A327883 25,5,24,14,23,0,46,15,45,10,44,16,43,3,42,17,41,9,40,18,39,1,38,19,37,8 %N A327883 a(0)=a(1)=0; thereafter a(n+1) is the index of the earliest as yet unused occurrence of a(n) if a(n) has occurred before; otherwise a(n+1) = a(a(n)-1). Once an occurrence of a(n) has been used it cannot be used again. %C A327883 For n > 2, a(n+1) is either the index or repeat of an earlier term (see Name). Hence terms are referred to here as being "index" or "repeat" respectively. Starting from a(3)=1, index and repeat terms occur alternatively throughout the sequence. %C A327883 a(n) < n for all n >= 0. For k >= 2, numbers 0,1,...,2^k-2 occur as terms in the interval between a(2^k-2) = 0 and a(2^(k+1)-2) = 0; see Formula (e.g., k = 2 --> 0,1,2 occur between a(2) and a(6); k = 3 --> 0,1,..,6 occur between a(6) and a(14)). Thus every integer >= 0 occurs infinitely many times in the sequence. %C A327883 There appears to be a proper copy subsequence given by a(4*m+2) = a(m-1); m >0 (noticed by Carl J Love). There may be other (independent) copies to be found (e.g. by selecting terms sequentially, one from each of the above mentioned intervals). A family of sequences similar to this one can be described using the same rule as above, with offset k >= 0 and initial terms a(k) = a(k+1) = k. Conjecture: Every such sequence contains a proper copy of itself as a(4*m+2+k) = a(m+k-1). %C A327883 Index terms > 0 are 1,2,4,3,6,5,10,9,8,7,14,13,... (see A132666). Repeat terms from a(4)=0 are 0,0,1,0,2,0,3,1,4,0,5,2,6,0,7,... (union of the nonnegative integers interleaved with the copy subsequence described above). %C A327883 For any n >= 0, a k >= 0 exists such that a^k(n)=0 (e.g., n=5 -> k=2; a^2(5)=0). %C A327883 Replacing a(a(n)-1) with a(a(n)+1) in the Name produces A025480 with 0 prepended. %H A327883 Rémy Sigrist, <a href="/A327883/b327883.txt">Table of n, a(n) for n = 0..10000</a> %H A327883 Michael De Vlieger, <a href="/A327883/a327883.png">Log log scatterplot of a(n)</a>, n = 0..2^20, showing a(n) = 0 instead as 1/2 for visibility. %F A327883 Conjectured formulae: %F A327883 a(2^k-2)=0 = a(3*2^k-2) = 0; (k>=0). %F A327883 a(5*2^k-2) = 1, a(7*2^k-2) = 2, (k>=0). %F A327883 a(11*2^(2*k)-2) = a(9*2^(2*k+1)-2) = 3 (k>=0). %F A327883 a(11*2^(2*k+1)-2) = a(9*2^(2k)-2) = 4 (k>=0). %F A327883 a(2*k+1) = A132666(k); k >= 1. %F A327883 a(4*k) = k-1; k >= 1. %F A327883 1st-level copy subsequence: a(k-1) = a(4*k+2), k >= 1. %F A327883 (m-th)-level (dependent) copy subsequence: a(k) = a(4^m*(k+2) - 2), m >= 1, k >= 0. %e A327883 a(2) = 0 since a(1) = 0 was last seen as a(0); a(3) = 1 since a(2) = 0 was last seen as a(1); a(4) = 0 since a(3) = 1 has not been seen before, so a(4) = a(a(3)-1) = a(0) = 0; a(327883)=163736. %p A327883 # Code by Carl J Love (via Mapleprimes). (This code is derived from Name. An alternative code (same author), based on a recursion deduced from empirical formulae (see above) produces identical output up to 100000 terms.) %p A327883 restart: %p A327883 a:= module() %p A327883 export %p A327883 pos:= table([0= 0]), nextpos:= table([0= 1]), %p A327883 used:= table(sparse, [0= 2]), %p A327883 ModuleApply:= proc(n::nonnegint) %p A327883 option remember; %p A327883 local p:= thisproc(n-1), r:= `if`(used[p] > 1, pos[p], thisproc(p-1)); %p A327883 (pos[r], used[r], nextpos[r]):= (nextpos[r], used[r]+1, n); %p A327883 r %p A327883 end proc; %p A327883 (ModuleApply(0), ModuleApply(1)):= (0,0) %p A327883 end module : %p A327883 seq(a(k), k= 0..100); %t A327883 nn = 1000; c[_] := 0; a[0] = a[1] = a[2] = 0; c[0] = 1; Do[If[# == 0, k = a[a[n - 1] - 1], k = #] &[c[a[n - 1]]]; Set[{a[n], c[a[n - 1]]}, {k, n - 1}], {n, 3, nn}]; Array[a, nn + 1, 0] (* _Michael De Vlieger_, Jun 25 2025 *) %Y A327883 Cf. A132666, A025480. %K A327883 nonn,look %O A327883 0,6 %A A327883 _David James Sycamore_, Oct 10 2019