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.

A352808 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, a(n) AND a(floor(n/2)) = 0 (where AND denotes the bitwise AND operator).

This page as a plain text file.
%I A352808 #26 May 18 2022 22:08:21
%S A352808 0,1,2,4,5,8,3,9,10,16,6,7,12,20,18,22,17,21,11,13,24,25,32,40,19,33,
%T A352808 34,35,36,37,41,64,14,38,42,66,48,52,50,80,39,65,68,70,15,23,67,69,44,
%U A352808 72,26,28,29,73,76,84,27,74,82,88,86,128,30,31,49,81,89
%N A352808 Lexicographically earliest sequence of distinct nonnegative integers such that for any n >= 0, a(n) AND a(floor(n/2)) = 0 (where AND denotes the bitwise AND operator).
%C A352808 This sequence has connections with A109812; each term (except the first) has no 1 bit in common with some prior term.
%C A352808 This sequence is a permutation of the natural numbers. [Proof: The first term divisible by a given power of 2, 2^k say, is 2^k itself, and for k >= 3, it is immediately followed by the smallest missing number. Since there are infinitely many powers of 2, every number will eventually appear. - _N. J. A. Sloane_, May 17 2022]
%C A352808 An alternative and equivalent definition: a(0)=0, a(1)=1. For k >= 1, a(2*k) and a(2*k+1) are the two smallest numbers not yet in the sequence whose binary expansions have no 1's in common with the binary expansion of a(k). - _N. J. A. Sloane_, May 17 2022
%H A352808 Rémy Sigrist, <a href="/A352808/b352808.txt">Table of n, a(n) for n = 0..10000</a>
%H A352808 Rémy Sigrist, <a href="/A352808/a352808.txt">C++ program</a>
%H A352808 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A352808 The initial terms a(n), alongside the binary expansions of a(n) and a(floor(n/2)), are:
%e A352808   n   a(n)  bin(a(n))  bin(a(floor(n/2)))
%e A352808   --  ----  ---------  ------------------
%e A352808    0     0          0                   0
%e A352808    1     1          1                   0
%e A352808    2     2         10                   1
%e A352808    3     4        100                   1
%e A352808    4     5        101                  10
%e A352808    5     8       1000                  10
%e A352808    6     3         11                 100
%e A352808    7     9       1001                 100
%e A352808    8    10       1010                 101
%e A352808    9    16      10000                 101
%e A352808   10     6        110                1000
%e A352808   11     7        111                1000
%e A352808   12    12       1100                  11
%o A352808 (C++) See Links section.
%o A352808 (Python)
%o A352808 from itertools import count, islice
%o A352808 def agen(): # generator of terms
%o A352808     alst = [0, 1]; aset = {0, 1}; yield from alst
%o A352808     mink = 2
%o A352808     for n in count(2):
%o A352808         ahalf, k = alst[n//2], mink
%o A352808         while k in aset or k&ahalf: k += 1
%o A352808         alst.append(k); aset.add(k); yield k
%o A352808         while mink in aset: mink += 1
%o A352808 print(list(islice(agen(), 67))) # _Michael S. Branicky_, May 17 2022
%Y A352808 Cf. A109812, A353731 (primes), A353732 (inverse), A354141 (powers of 2), A354142, A353733 (variant).
%K A352808 nonn,look,base
%O A352808 0,3
%A A352808 _Rémy Sigrist_, Apr 04 2022