%I #18 Feb 06 2023 15:04:09
%S 1,2,3,4,8,12,16,32,48,64,85,106,128,150,171,216,237,247,256,279,297,
%T 452,512,537,558,594,640,803,860,997,1024,1051,1069,1115,1169,1333,
%U 1345,1620,1866,2048,2077,2086,2159,2257,2363,2446,2737,2860,3212,3335,3761
%N Lexicographically earliest sequence of distinct positive integers such that the bitwise XOR of two distinct terms are all distinct.
%C This sequence is well defined as we can always extend it with a power of 2 not yet in the sequence.
%C This sequence contains all powers of 2 (A000079).
%C This sequence has similarities with A011185: here we combine terms with the bitwise XOR operator, there with the addition.
%C Every positive integer can be uniquely expressed as a(i) XOR a(j) with i < j (see A360364).
%H Rémy Sigrist, <a href="/A360363/b360363.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A360363/a360363.txt">C++ program</a>
%e The first terms are:
%e n a(n) a(k) XOR a(n) (for k = 1..n-1)
%e -- ---- ----------------------------------------------------------
%e 1 1 N/A
%e 2 2 3
%e 3 3 2, 1
%e 4 4 5, 6, 7
%e 5 8 9, 10, 11, 12
%e 6 12 13, 14, 15, 8, 4
%e 7 16 17, 18, 19, 20, 24, 28
%e 8 32 33, 34, 35, 36, 40, 44, 48
%e 9 48 49, 50, 51, 52, 56, 60, 32, 16
%e 10 64 65, 66, 67, 68, 72, 76, 80, 96, 112
%e 11 85 84, 87, 86, 81, 93, 89, 69, 117, 101, 21
%e 12 106 107, 104, 105, 110, 98, 102, 122, 74, 90, 42, 63
%e 13 128 129, 130, 131, 132, 136, 140, 144, 160, 176, 192, 213, 234
%o (C++) See Links section.
%o (Python)
%o from itertools import islice
%o def agen(): # generator of terms
%o aset, xset, k = set(), set(), 0
%o while True:
%o k += 1
%o while any(k^an in xset for an in aset): k += 1
%o yield k; xset.update(k^an for an in aset); aset.add(k)
%o print(list(islice(agen(), 51))) # _Michael S. Branicky_, Feb 05 2023
%Y Cf. A000079, A011185, A346298, A360364.
%K nonn,base
%O 1,2
%A _Rémy Sigrist_, Feb 04 2023