The OEIS is supported by the many generous donors to the OEIS Foundation. Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 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. 2

%I

%S 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 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 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 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 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 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 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 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 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 Replacing a(a(n)-1) with a(a(n)+1) in the Name produces A025480 with 0 prepended.

%H Rémy Sigrist, <a href="/A327883/b327883.txt">Table of n, a(n) for n = 0..10000</a>

%F Conjectured formulae:

%F a(2^k-2)=0 = a(3*2^k-2) = 0; (k>=0).

%F a(5*2^k-2) = 1, a(7*2^k-2) = 2, (k>=0).

%F a(11*2^(2*k)-2) = a(9*2^(2*k+1)-2) = 3 (k>=0).

%F a(11*2^(2*k+1)-2) = a(9*2^(2k)-2) = 4 (k>=0).

%F a(2*k+1) = A32666(k); k >= 1.

%F a(4*k) = k-1; k >= 1.

%F 1st-level copy subsequence: a(k-1) = a(4*k+2), k >= 1.

%F (m-th)-level (dependent) copy subsequence: a(k) = a(4^m*(k+2) - 2), m >= 1, k >= 0.

%e 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 # 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 restart:

%p a:= module()

%p export

%p pos:= table([0= 0]), nextpos:= table([0= 1]),

%p used:= table(sparse, [0= 2]),

%p ModuleApply:= proc(n::nonnegint)

%p option remember;

%p local p:= thisproc(n-1), r:= `if`(used[p] > 1, pos[p], thisproc(p-1));

%p (pos[r], used[r], nextpos[r]):= (nextpos[r], used[r]+1, n);

%p r

%p end proc;

%p (ModuleApply(0), ModuleApply(1)):= (0,0)

%p end module :

%p seq(a(k), k= 0..100);

%Y Cf. A132666, A025480.

%K nonn

%O 0,6

%A _David James Sycamore_, Oct 10 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified January 20 00:08 EST 2022. Contains 350467 sequences. (Running on oeis4.)