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.

A356149 Irregular table T(n, k), n > 0, k = 1..A356148(n), read by rows; the n-th row contains, in ascending order, the distinct positive integers whose binary expansion appears as a substring in the binary expansion of n or its complement.

This page as a plain text file.
%I A356149 #11 Jul 31 2022 19:54:04
%S A356149 1,1,2,1,3,1,2,3,4,1,2,5,1,2,3,6,1,3,7,1,2,3,4,7,8,1,2,3,4,6,9,1,2,5,
%T A356149 10,1,2,3,4,5,11,1,2,3,4,6,12,1,2,3,5,6,13,1,2,3,6,7,14,1,3,7,15,1,2,
%U A356149 3,4,7,8,15,16,1,2,3,4,6,7,8,14,17,1,2,3,4,5,6,9,13,18
%N A356149 Irregular table T(n, k), n > 0, k = 1..A356148(n), read by rows; the n-th row contains, in ascending order, the distinct positive integers whose binary expansion appears as a substring in the binary expansion of n or its complement.
%C A356149 Leading 0's in binary expansions are ignored.
%C A356149 The n-th contains the n-th row of A165416.
%H A356149 Rémy Sigrist, <a href="/A356149/b356149.txt">Table of n, a(n) for n = 1..26775</a>
%H A356149 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F A356149 T(n, 1) = 1.
%F A356149 T(n, A356148(n)) = n.
%e A356149 Table T(n, k) begins:
%e A356149     1;
%e A356149     1, 2;
%e A356149     1, 3;
%e A356149     1, 2, 3, 4;
%e A356149     1, 2, 5;
%e A356149     1, 2, 3, 6;
%e A356149     1, 3, 7;
%e A356149     1, 2, 3, 4, 7, 8;
%e A356149     1, 2, 3, 4, 6, 9;
%e A356149     1, 2, 5, 10;
%e A356149     1, 2, 3, 4, 5, 11;
%e A356149     1, 2, 3, 4, 6, 12;
%e A356149     1, 2, 3, 5, 6, 13;
%e A356149     1, 2, 3, 6, 7, 14;
%e A356149     1, 3, 7, 15;
%e A356149     1, 2, 3, 4, 7, 8, 15, 16;
%e A356149     ...
%o A356149 (PARI) row(n) = { my (b=binary(n)); setbinop((i,j) -> my (s=fromdigits(b[i..j],2)); if (b[i], s, 2^(j-i+1)-1-s), [1..#b]) }
%o A356149 (Python)
%o A356149 def row(n):
%o A356149     N = n.bit_length()
%o A356149     c, s = ((1<<N)-1)^n, set()
%o A356149     for i in range(N):
%o A356149         for l in range(N-i):
%o A356149             mask = ((2<<l)-1) << i
%o A356149             s.add((mask&n) >> i)
%o A356149             s.add((mask&c) >> i)
%o A356149     return sorted(s - {0})
%o A356149 print([t for r in range(19) for t in row(r)]) # _Michael S. Branicky_, Jul 28 2022
%Y A356149 Cf. A165416, A356148, A356150.
%K A356149 nonn,base,tabf
%O A356149 1,3
%A A356149 _Rémy Sigrist_, Jul 28 2022