cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A372325 Numbers whose binary expansion has an even number of 1's among positions listed in this sequence.

This page as a plain text file.
%I A372325 #28 May 28 2024 18:27:32
%S A372325 0,2,5,7,8,10,13,15,16,18,21,23,24,26,29,31,33,35,36,38,41,43,44,46,
%T A372325 49,51,52,54,57,59,60,62,64,66,69,71,72,74,77,79,80,82,85,87,88,90,93,
%U A372325 95,97,99,100,102,105,107,108,110,113,115,116,118,121,123,124
%N A372325 Numbers whose binary expansion has an even number of 1's among positions listed in this sequence.
%H A372325 Robert Israel, <a href="/A372325/b372325.txt">Table of n, a(n) for n = 1..10000</a>
%e A372325 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.
%e A372325 8192 is not in the sequence because 8192 = 2^13, and 13 is in the sequence.
%p A372325 R:= 0: RL:= [1]: nextp:= 2: m:= 1: count:= 0:
%p A372325 for i from 1 while count < 100 do
%p A372325   L:= convert(i,base,2);
%p A372325   if i = nextp then
%p A372325     nextp:= 2*nextp;
%p A372325     if R[1+nops(RL)] = m then RL:= [op(RL),m+1] fi;
%p A372325     m:= m+1;
%p A372325   fi;
%p A372325   if convert(L[RL],`+`)::even
%p A372325   then R:= R,i; count:= count+1
%p A372325   fi
%p A372325 od:
%p A372325 R; # _Robert Israel_, May 28 2024
%o A372325 (Python)
%o A372325 from itertools import count, islice
%o A372325 def agen():  # generator of terms
%o A372325     aset = 0 # stored as a bitmask
%o A372325     for k in count(0):
%o A372325         if (k&aset).bit_count()%2 == 0:
%o A372325             yield k
%o A372325             aset += (1<<k)
%o A372325 print(list(islice(agen(), 63))) # _Michael S. Branicky_, Apr 28 2024
%Y A372325 Cf. A133457, A272011.
%K A372325 nonn,easy,base
%O A372325 1,2
%A A372325 _David A. Madore_, Apr 27 2024