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.

Original entry on oeis.org

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

Views

Author

David A. Madore, Apr 27 2024

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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
  • 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<Michael S. Branicky, Apr 28 2024