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.

Showing 1-3 of 3 results.

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.

Original entry on oeis.org

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, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 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
Offset: 1

Views

Author

Rémy Sigrist, Oct 12 2022

Keywords

Comments

Leading zeros in binary expansions are ignored.
For any n > 0, there are A274005(n)/2 positive terms with binary length n.
Empirically, if t is a term, then at least one of 2*t or 2*t + 1 is also a term.
If t is a term, then floor(t/2) is also a term.
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

Examples

			For k = 12:
- the binary expansion of k is "1100",
- blocks of length 1 have Hamming weight 0 or 1,
- blocks of length 2 have Hamming weight 0, 1 or 2,
- blocks of length 3 have Hamming weight 1 or 2,
- blocks of length 4 have Hamming weight 2,
- so 12 belongs to the sequence.
For k = 56:
- the binary expansion of 44 is "111000",
- blocks of length 3 have Hamming weight 0, 1, 2 or 3,
- so 56 does not belong to the sequence.
		

Crossrefs

Programs

  • PARI
    \\ See Links section.
    
  • Python
    def ok(n):
        b = bin(n)[2:]
        if "000" in b and "111" in b: return False
        for l in range(4, len(b)-1):
            h = set(b[i:i+l].count("1") for i in range(len(b)-l+1))
            if max(h) - min(h) > 2: return False
        return True
    print([k for k in range(69) if ok(k)]) # Michael S. Branicky, Oct 12 2022

Extensions

a(69) onwards from Andrew Howroyd, Oct 09 2024

A274008 Number of length-n ternary sequences where the sum of each block differs by at most 1 from every other block of the same length.

Original entry on oeis.org

1, 3, 7, 15, 27, 47, 71, 107, 151, 207, 271, 355, 447, 563, 691, 835, 995, 1187, 1391, 1631, 1887, 2167, 2467, 2811, 3171, 3571, 3995, 4455, 4939, 5479, 6035, 6651, 7299, 7987, 8707, 9475, 10267, 11131, 12031, 12979, 13959, 15019, 16103, 17271, 18479, 19735
Offset: 0

Views

Author

Jeffrey Shallit, Jun 06 2016

Keywords

Examples

			For n = 2 the only strings omitted are 02 and 20.
		

Crossrefs

Cf. A005598, which is the analogous sequence where "ternary" is replaced by "binary".
Cf. A274005, which is the analogous sequence where "ternary" is replaced by "binary" and "1" is replaced by "2".

Formula

a(n) = 2*A005598(n) - 1. - Rémy Sigrist, Oct 11 2022

Extensions

More terms from Rémy Sigrist, Oct 11 2022

A362063 Number of 2-balanced binary words of length n with respect to the permutations of the symbols.

Original entry on oeis.org

1, 1, 2, 4, 8, 16, 31, 60, 111, 205, 364, 647, 1110, 1908, 3190, 5345, 8743, 14352, 23090, 37232, 59113, 94079, 147531, 232073, 360750, 561692, 865823, 1338269, 2047388, 3139690, 4781349, 7281656, 11021651, 16716751, 25178531, 37994309, 57046272
Offset: 0

Views

Author

Dominika Datko, communicated by Bartlomiej Pawlik, Apr 07 2023

Keywords

Comments

2-balanced binary words are here defined as the binary words with such property that the sum of each subblock differs by at most 2 from every other subblock of the same length.
Can be interpreted as a number of 2-balanced binary words with the prefix "0".

Examples

			a(3) = 4 since 000, 001, 010 and 011 are 2-balanced.
a(6) = 31 since all words of form 0XXXXX are 2-balanced, except the word 000111.
		

Crossrefs

A274005 is the number of all binary 2-balanced words with given length.
A005598 is the number of all binary balanced (1-balanced) words with given length.

Formula

a(n) = A274005(n)/2 for n>0, since A274005 is the number of all binary 2-balanced words of given length.
Showing 1-3 of 3 results.