Identifier
Identifier
Values
[] generating graphics... => 1
[1] generating graphics... => 1
[2] generating graphics... => 1
[1,1] generating graphics... => 2
[3] generating graphics... => 1
[2,1] generating graphics... => 3
[1,1,1] generating graphics... => 5
[4] generating graphics... => 1
[3,1] generating graphics... => 4
[2,2] generating graphics... => 6
[2,1,1] generating graphics... => 10
[1,1,1,1] generating graphics... => 17
[5] generating graphics... => 1
[4,1] generating graphics... => 5
[3,2] generating graphics... => 10
[3,1,1] generating graphics... => 17
[2,2,1] generating graphics... => 24
[2,1,1,1] generating graphics... => 41
[1,1,1,1,1] generating graphics... => 70
[6] generating graphics... => 1
[5,1] generating graphics... => 6
[4,2] generating graphics... => 15
[4,1,1] generating graphics... => 26
[3,3] generating graphics... => 20
[3,2,1] generating graphics... => 48
[3,1,1,1] generating graphics... => 83
[2,2,2] generating graphics... => 67
[2,2,1,1] generating graphics... => 116
[2,1,1,1,1] generating graphics... => 201
[1,1,1,1,1,1] generating graphics... => 349
[7] generating graphics... => 1
[6,1] generating graphics... => 7
[5,2] generating graphics... => 21
[5,1,1] generating graphics... => 37
[4,3] generating graphics... => 35
[4,2,1] generating graphics... => 85
[4,1,1,1] generating graphics... => 149
[3,3,1] generating graphics... => 110
[3,2,2] generating graphics... => 153
[3,2,1,1] generating graphics... => 268
[3,1,1,1,1] generating graphics... => 470
[2,2,2,1] generating graphics... => 373
[2,2,1,1,1] generating graphics... => 654
[2,1,1,1,1,1] generating graphics... => 1148
[1,1,1,1,1,1,1] generating graphics... => 2017
[8] generating graphics... => 1
[7,1] generating graphics... => 8
[6,2] generating graphics... => 28
[6,1,1] generating graphics... => 50
[5,3] generating graphics... => 56
[5,2,1] generating graphics... => 138
[5,1,1,1] generating graphics... => 245
[4,4] generating graphics... => 70
[4,3,1] generating graphics... => 220
[4,2,2] generating graphics... => 306
[4,2,1,1] generating graphics... => 542
[4,1,1,1,1] generating graphics... => 961
[3,3,2] generating graphics... => 392
[3,3,1,1] generating graphics... => 694
[3,2,2,1] generating graphics... => 966
[3,2,1,1,1] generating graphics... => 1712
[3,1,1,1,1,1] generating graphics... => 3037
[2,2,2,2] generating graphics... => 1345
[2,2,2,1,1] generating graphics... => 2384
[2,2,1,1,1,1] generating graphics... => 4230
[2,1,1,1,1,1,1] generating graphics... => 7513
[1,1,1,1,1,1,1,1] generating graphics... => 13358
[9] generating graphics... => 1
[8,1] generating graphics... => 9
[7,2] generating graphics... => 36
[7,1,1] generating graphics... => 65
[6,3] generating graphics... => 84
[6,2,1] generating graphics... => 210
[6,1,1,1] generating graphics... => 377
[5,4] generating graphics... => 126
[5,3,1] generating graphics... => 399
[5,2,2] generating graphics... => 556
[5,2,1,1] generating graphics... => 995
[5,1,1,1,1] generating graphics... => 1782
[4,4,1] generating graphics... => 490
[4,3,2] generating graphics... => 870
[4,3,1,1] generating graphics... => 1555
[4,2,2,1] generating graphics... => 2168
[4,2,1,1,1] generating graphics... => 3879
[4,1,1,1,1,1] generating graphics... => 6946
[3,3,3] generating graphics... => 1109
[3,3,2,1] generating graphics... => 2763
[3,3,1,1,1] generating graphics... => 4942
[3,2,2,2] generating graphics... => 3853
[3,2,2,1,1] generating graphics... => 6893
[3,2,1,1,1,1] generating graphics... => 12342
[3,1,1,1,1,1,1] generating graphics... => 22117
[2,2,2,2,1] generating graphics... => 9615
[2,2,2,1,1,1] generating graphics... => 17219
[2,2,1,1,1,1,1] generating graphics... => 30862
[2,1,1,1,1,1,1,1] generating graphics... => 55359
[1,1,1,1,1,1,1,1,1] generating graphics... => 99377
click to show generating function       
Description
The number of words with multiplicities of the letters given by the partition, avoiding the consecutive pattern 123.
The total number of words with letter multiplicities given by an integer partition is St000048The multinomial of the parts of a partition.. For example, there are twelve words with letters $0,0,1,2$ corresponding to the partition $[2,1,1]$. Two of these contain an increasing factor of length three: $0012$ and $0120$.
Note that prescribing the multiplicities for different letters yields the same number. For example, there are also two words with letters $0,1,1,2$ containing an increasing factor of length three: $1012$ and $0121$.
The number of words of length $n$ with letters in an alphabet of size $k$ avoiding the consecutive pattern $123$ is determined in [1].
References
[1] Burstein, A. Enumeration of words with forbidden patterns MathSciNet:2697353
Code
def avoids(w, pattern):
    l = [len(p) for p in pattern]
    l_p = len(pattern)
    n = len(w)
    A = sorted(list(set([a for p in pattern for a in p])))
    pattern = [[A.index(a) for a in p] for p in pattern]
    k = 1+max(max(p) for p in pattern)

    def is_match(s):
        assignment = [None]*k
        for i in range(l_p):
            for j in range(len(pattern[i])):
                l = w[s[i]+j]
                p = pattern[i][j]
                m = assignment[p]
                if m is None:
                    assignment[p] = l
                elif m != l:
                    return False
    
        return all(assignment[i] < assignment[i+1] for i in range(k-1))
    
    for s in Subsets(list(range(len(w))), l_p)._fast_iterator():
        if all(s[i]+l[i] <= s[i+1] for i in range(l_p-1)) and s[-1]+l[-1] <= n:
            if is_match(s):
                return False
    return True

def statistic(la):
    mset = [i for i, p in enumerate(la) for _ in range(p)]
    return len([w for w in Permutations(mset) if avoids(w, [[1,2,3]])])

Created
Feb 04, 2018 at 00:36 by Martin Rubey
Updated
Feb 05, 2018 at 11:04 by Martin Rubey