login
a(1)=1; thereafter a(n) = smallest positive integer not among the earlier terms of the sequence such that a(n) and a(n-1) have an even number of common 1-bits in their binary representations
1

%I #22 Apr 03 2022 09:57:47

%S 1,2,4,3,7,5,8,6,9,11,10,14,12,13,16,15,19,17,21,20,22,18,23,25,24,26,

%T 28,27,31,29,32,30,33,35,34,38,36,37,41,39,42,40,43,44,52,45,47,46,50,

%U 48,49,54,55,51,56,53,58,59,57,61,60,62,64,63,67,65,69,68,70,66,71,73,72,74,76,75,79,77,81,80,82,78,83,84,88,85,87,86,89,91,90,94,92

%N a(1)=1; thereafter a(n) = smallest positive integer not among the earlier terms of the sequence such that a(n) and a(n-1) have an even number of common 1-bits in their binary representations

%C A variant of A109812. Sharing an even number of common 1-bits is equivalent to zero correlation between sequences in the vector space F_2^k.

%H Rémy Sigrist, <a href="/A352716/b352716.txt">Table of n, a(n) for n = 1..10000</a>

%H Rémy Sigrist, <a href="/A352716/a352716.gp.txt">PARI program</a>

%o (PARI) See Links section.

%o (Python 3.10+)

%o from itertools import islice

%o def A352716_gen(): # generator of terms

%o yield 1

%o l1, s, b = 1, 2, set()

%o while True:

%o i = s

%o while True:

%o if not (i in b or (i & l1).bit_count() % 2):

%o yield i

%o l1 = i

%o b.add(i)

%o while s in b:

%o b.remove(s)

%o s += 1

%o break

%o i += 1

%o A352716_list = list(islice(A352716_gen(),20)) # _Chai Wah Wu_, Apr 02 2022

%Y Cf. A109812, A352715.

%K nonn

%O 1,2

%A _Chai Wah Wu_, _Michael De Vlieger_, _Rémy Sigrist_, and _N. J. A. Sloane_, Mar 30 2022