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.

A357759 Numbers k such that in the binary expansion of k, the Hamming weight of each block differs by at most 2 from every other block of the same length.

This page as a plain text file.
%I A357759 #18 Oct 09 2024 18:31:16
%S A357759 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,
%T A357759 26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,
%U A357759 49,50,51,52,53,54,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75
%N A357759 Numbers k such that in the binary expansion of k, the Hamming weight of each block differs by at most 2 from every other block of the same length.
%C A357759 Leading zeros in binary expansions are ignored.
%C A357759 For any n > 0, there are A274005(n)/2 positive terms with binary length n.
%C A357759 Empirically, if t is a term, then at least one of 2*t or 2*t + 1 is also a term.
%C A357759 If t is a term, then floor(t/2) is also a term.
%C A357759 The complement with respect to the nonnegative integers is 56, 71, 112, 113, 120, 135, 142, 143, 176, 184, 199, ... - _Andrew Howroyd_, Oct 09 2024
%H A357759 Andrew Howroyd, <a href="/A357759/b357759.txt">Table of n, a(n) for n = 1..7658</a>
%H A357759 Rémy Sigrist, <a href="/A357759/a357759.gp.txt">PARI program</a>
%H A357759 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%e A357759 For k = 12:
%e A357759 - the binary expansion of k is "1100",
%e A357759 - blocks of length 1 have Hamming weight 0 or 1,
%e A357759 - blocks of length 2 have Hamming weight 0, 1 or 2,
%e A357759 - blocks of length 3 have Hamming weight 1 or 2,
%e A357759 - blocks of length 4 have Hamming weight 2,
%e A357759 - so 12 belongs to the sequence.
%e A357759 For k = 56:
%e A357759 - the binary expansion of 44 is "111000",
%e A357759 - blocks of length 3 have Hamming weight 0, 1, 2 or 3,
%e A357759 - so 56 does not belong to the sequence.
%o A357759 (PARI) \\ See Links section.
%o A357759 (Python)
%o A357759 def ok(n):
%o A357759     b = bin(n)[2:]
%o A357759     if "000" in b and "111" in b: return False
%o A357759     for l in range(4, len(b)-1):
%o A357759         h = set(b[i:i+l].count("1") for i in range(len(b)-l+1))
%o A357759         if max(h) - min(h) > 2: return False
%o A357759     return True
%o A357759 print([k for k in range(69) if ok(k)]) # _Michael S. Branicky_, Oct 12 2022
%Y A357759 Cf. A274005, A357758.
%K A357759 nonn,base
%O A357759 1,3
%A A357759 _Rémy Sigrist_, Oct 12 2022
%E A357759 a(69) onwards from _Andrew Howroyd_, Oct 09 2024