login
A372325
Numbers whose binary expansion has an even number of 1's among positions listed in this sequence.
1
0, 2, 5, 7, 8, 10, 13, 15, 16, 18, 21, 23, 24, 26, 29, 31, 33, 35, 36, 38, 41, 43, 44, 46, 49, 51, 52, 54, 57, 59, 60, 62, 64, 66, 69, 71, 72, 74, 77, 79, 80, 82, 85, 87, 88, 90, 93, 95, 97, 99, 100, 102, 105, 107, 108, 110, 113, 115, 116, 118, 121, 123, 124
OFFSET
1,2
LINKS
EXAMPLE
118 is in the sequence because 118 = 2^6 + 2^5 + 2^4 + 2^2 + 2^1, and an even number of the exponents 6,5,4,2,1 (namely 2,5) are in the sequence.
8192 is not in the sequence because 8192 = 2^13, and 13 is in the sequence.
MAPLE
R:= 0: RL:= [1]: nextp:= 2: m:= 1: count:= 0:
for i from 1 while count < 100 do
L:= convert(i, base, 2);
if i = nextp then
nextp:= 2*nextp;
if R[1+nops(RL)] = m then RL:= [op(RL), m+1] fi;
m:= m+1;
fi;
if convert(L[RL], `+`)::even
then R:= R, i; count:= count+1
fi
od:
R; # Robert Israel, May 28 2024
PROG
(Python)
from itertools import count, islice
def agen(): # generator of terms
aset = 0 # stored as a bitmask
for k in count(0):
if (k&aset).bit_count()%2 == 0:
yield k
aset += (1<<k)
print(list(islice(agen(), 63))) # Michael S. Branicky, Apr 28 2024
CROSSREFS
Sequence in context: A102700 A095371 A047481 * A158704 A131854 A005124
KEYWORD
nonn,easy,base
AUTHOR
David A. Madore, Apr 27 2024
STATUS
approved