A210426 Number of 4-divided words of length n over a 4-letter alphabet.
0, 0, 0, 1, 44, 450, 3175, 17977, 91326, 433434, 1968268, 8674028, 37428470, 159059732
Offset: 1
Keywords
Programs
-
Python
from itertools import product, combinations, permutations def is4div(b): for i, j, k in combinations(range(1, len(b)), 3): divisions = [b[:i], b[i:j], b[j:k], b[k:]] all_greater = True for p, bp in enumerate(permutations(divisions)): if p == 0: continue if b >= "".join(bp): all_greater = False; break if all_greater: return True return False def a(n): return sum(is4div("".join(b)) for b in product("0123", repeat=n)) print([a(n) for n in range(1, 9)]) # Michael S. Branicky, Aug 30 2021
Extensions
a(11)-a(14) from Michael S. Branicky, Aug 30 2021
Comments