OFFSET
1,2
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn,easy,base
AUTHOR
David A. Madore, Apr 27 2024
STATUS
approved