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.

A238109 List of prefix-normal words over the alphabet {1,2}.

Original entry on oeis.org

1, 2, 11, 12, 22, 111, 112, 121, 122, 222, 1111, 1112, 1121, 1122, 1212, 1221, 1222, 2222, 11111, 11112, 11121, 11122, 11211, 11212, 11221, 11222, 12121, 12122, 12212, 12221, 12222, 22222, 111111, 111112, 111121, 111122, 111211, 111212, 111221, 111222, 112112
Offset: 1

Views

Author

N. J. A. Sloane, Mar 02 2014

Keywords

Comments

A word of length n over the alphabet {a,b} is prefix-normal if for all 1 <= k <= n, no factor of length k has more a's than the prefix of length k. For example, abbabab is not prefix-normal because aba has more a's than abb.

Crossrefs

Cf. A194850.

Extensions

More terms from Rémy Sigrist, Feb 12 2017

A238110 Maximum size of a class of binary words of length n having the same prefix normal form.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 10, 12, 18, 24, 30, 40, 60, 80, 111, 165, 246, 369, 596, 894, 1406, 2109, 3462, 5193, 8528, 12792, 21390, 32085, 53206, 79809, 135064, 202596
Offset: 1

Views

Author

N. J. A. Sloane, Mar 02 2014

Keywords

Crossrefs

Extensions

a(17)-a(33) from Lars Blomberg, Jun 16 2017

A308465 Number of prefix normal palindromes of length n.

Original entry on oeis.org

2, 2, 3, 3, 5, 4, 8, 7, 12, 11, 21, 18, 36, 31, 57, 55, 104, 91, 182, 166, 308, 292, 562, 512, 1009, 928, 1755, 1697, 3247, 2972, 5906, 5555, 10506, 10099, 19542, 18280, 36002, 33895, 64958, 63045, 121887, 114032, 226065, 215377, 412749, 399334, 778196, 735941
Offset: 1

Views

Author

Michel Marcus, May 29 2019

Keywords

Crossrefs

Cf. A016116 (numbers of binary palindromes), A194850 (number of prefix normal words)

Programs

  • Python
    from itertools import product
    def is_prefix_normal(w):
      for k in range(1, len(w)+1):
        weight0 = w[:k].count("1")
        for j in range(1, len(w)-k+1):
          weightj = w[j:j+k].count("1")
          if weightj > weight0: return False
      return True
    def bin_pals(digits):
      midrange = [[""], ["0", "1"]]
      for p in product("01", repeat=digits//2):
        left = "".join(p)
        for middle in midrange[digits%2]:
          yield left+middle+left[::-1]
    def a(n):
      return sum(is_prefix_normal(w) for w in bin_pals(n))
    print([a(n) for n in range(1, 31)]) # Michael S. Branicky, Dec 19 2020

Extensions

a(31)-a(48) from Michael S. Branicky, Dec 19 2020
Showing 1-3 of 3 results.