OFFSET
0,6
COMMENTS
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.
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.
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).
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).
For any n >= 0, a k >= 0 exists such that a^k(n)=0 (e.g., n=5 -> k=2; a^2(5)=0).
Replacing a(a(n)-1) with a(a(n)+1) in the Name produces A025480 with 0 prepended.
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..10000
FORMULA
Conjectured formulae:
a(2^k-2)=0 = a(3*2^k-2) = 0; (k>=0).
a(5*2^k-2) = 1, a(7*2^k-2) = 2, (k>=0).
a(11*2^(2*k)-2) = a(9*2^(2*k+1)-2) = 3 (k>=0).
a(11*2^(2*k+1)-2) = a(9*2^(2k)-2) = 4 (k>=0).
a(2*k+1) = A132666(k); k >= 1.
a(4*k) = k-1; k >= 1.
1st-level copy subsequence: a(k-1) = a(4*k+2), k >= 1.
(m-th)-level (dependent) copy subsequence: a(k) = a(4^m*(k+2) - 2), m >= 1, k >= 0.
EXAMPLE
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.
MAPLE
# 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.)
restart:
a:= module()
export
pos:= table([0= 0]), nextpos:= table([0= 1]),
used:= table(sparse, [0= 2]),
ModuleApply:= proc(n::nonnegint)
option remember;
local p:= thisproc(n-1), r:= `if`(used[p] > 1, pos[p], thisproc(p-1));
(pos[r], used[r], nextpos[r]):= (nextpos[r], used[r]+1, n);
r
end proc;
(ModuleApply(0), ModuleApply(1)):= (0, 0)
end module :
seq(a(k), k= 0..100);
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Oct 10 2019
STATUS
approved