login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A348080
A variant of Van Eck's sequence: For n >= 1, if there exists an m < n such that a(m) = a(n), take the largest such m and set a(n+1) = n XOR m; otherwise a(n+1) = 0. Start with a(1)=0.
2
0, 0, 3, 0, 6, 0, 2, 0, 14, 0, 2, 12, 0, 7, 0, 2, 27, 0, 29, 0, 6, 16, 0, 3, 27, 8, 0, 12, 16, 11, 0, 4, 0, 62, 0, 2, 52, 0, 5, 0, 14, 32, 0, 3, 52, 8, 52, 2, 20, 0, 25, 0, 6, 32, 28, 0, 12, 37, 0, 3, 16, 32, 8, 17, 0, 122, 0, 2, 116, 0, 5, 96, 0, 15, 0, 2, 8
OFFSET
1,3
COMMENTS
XOR denotes the bitwise XOR operator.
This sequence is unbounded, and contains infinitely many 0's.
EXAMPLE
The first terms, alongside m, are:
n a(n) m
-- ---- ---
1 0 N/A
2 0 1
3 1 N/A
4 0 2
5 2 N/A
6 0 4
7 2 5
8 2 7
9 1 3
10 6 N/A
PROG
(PARI) { p=vector(123); v=0; for (n=1, 77, print1(v", "); [p[1+v], v]=[n, if (p[1+v], bitxor(n, p[1+v]), 0)]) }
CROSSREFS
Sequence in context: A321254 A262605 A092731 * A201567 A161829 A290705
KEYWORD
nonn,base,look
AUTHOR
Rémy Sigrist, Sep 27 2021
STATUS
approved