A213291
Number of n-length words w over ternary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 3, 9, 18, 36, 74, 165, 367, 869, 2074, 5168, 13026, 33749, 88368, 235389, 632324, 1717202, 4693604, 12921864, 35751336, 99416633, 277527448, 777659128, 2185854247, 6162168724, 17416305904, 49342480077, 140094014788, 398558682310, 1135962971848
Offset: 0
a(0) = 1: the empty word.
a(1) = 3: a, b, c for alphabet {a,b,c}.
a(2) = 9: aa, ab, ac, ba, bb, bc, ca, cb, cc.
a(3) = 18: aaa, aab, aac, aba, abc, aca, acb, baa, bac, bbb, bbc, bca, bcb, caa, cab, cba, cbb, ccc.
A213292
Number of n-length words w over 4-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 4, 16, 46, 118, 276, 712, 1805, 4895, 13280, 37993, 109386, 328219, 992413, 3101399, 9764376, 31580645, 102797899, 342075208, 1144125506, 3896297053, 13319243655, 46206520968, 160729837020, 565901313043, 1996113320841, 7111795754941, 25369213794266
Offset: 0
A213293
Number of n-length words w over 5-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 5, 25, 95, 315, 895, 2535, 7280, 21562, 64924, 201975, 640915, 2095019, 6978713, 23859310, 82982260, 295202798, 1066467105, 3928481530, 14672457970, 55722273963, 214254166369, 835669136725, 3295598362466, 13156401722237, 53038076210255, 216053087821059
Offset: 0
A213294
Number of n-length words w over 6-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 6, 36, 171, 711, 2506, 8151, 25781, 83728, 273248, 916966, 3121506, 10934875, 38945256, 142403783, 529393936, 2014819829, 7790840332, 30758499541, 123255094820, 503078455794, 2081817569353, 8756613613322, 37300624224737, 161213532001916, 704851308055768
Offset: 0
A213295
Number of n-length words w over 7-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 7, 49, 280, 1414, 6104, 23527, 83916, 296268, 1050777, 3771418, 13717679, 50861266, 191950441, 739460834, 2901202157, 11612278801, 47307362988, 196385040929, 828929230122, 3560359729835, 15531007871015, 68843517673532, 309567264833019, 1412620935530761
Offset: 0
A213296
Number of n-length words w over 8-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 8, 64, 428, 2556, 13224, 60600, 250062, 977026, 3754472, 14486158, 56109736, 220213038, 875120922, 3539254104, 14534439529, 60794185555, 258385808222, 1118113946883, 4915589687030, 21983704654711, 99825770573061, 460645444681024, 2156595097630195
Offset: 0
A213297
Number of n-length words w over 9-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 9, 81, 621, 4293, 26061, 140517, 676155, 2990967, 12602451, 52359693, 216954441, 901911273, 3778512489, 16012113225, 68739345546, 299377174968, 1323228682218, 5939020708851, 27063683050245, 125241936884631, 588324477445971, 2805460966739493
Offset: 0
A213298
Number of n-length words w over 10-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 10, 100, 865, 6805, 47590, 297595, 1662160, 8418649, 39598078, 178880725, 795246055, 3519278713, 15573399301, 69314501935, 311040898945, 1411268823196, 6478030875460, 30129403442530, 141971859499360, 678365095896001, 3285531463054108, 16137537771997720
Offset: 0
A321704
Number of words w of length n over an n-ary alphabet such that for every prefix z of w we have #(z,a_i) = 0 or #(z,a_i) >= #(z,a_j) for all j>i and #(z,a_i) counts the occurrences of the i-th letter in z.
Original entry on oeis.org
1, 1, 4, 18, 118, 895, 8151, 83916, 977026, 12602451, 178880725, 2766415036, 46314488705, 834067614601, 16074694453741, 330017679352180, 7188779521480810
Offset: 0
a(3) = 18: aaa, aab, aac, aba, abc, aca, acb, baa, bac, bbb, bbc, bca, bcb, caa, cab, cba, cbb, ccc.
-
h:= proc(n, k, m, l) option remember;
`if`(n=0 and k=0, b(l), `if`(k=0 or n>0 and n1 then for j from i+1 to nops(l) do
if l[i]<=l[j] then return false
elif l[j]>0 then break
fi od fi; true
end:
a:= n-> h(n$2, 0, []):
seq(a(n), n=0..10); # Alois P. Heinz, Mar 29 2020
-
h[n_, k_, m_, l_] := h[n, k, m, l] = If[n == 0 && k === 0, b[l], If[k == 0 || n > 0 && n < m, 0, Sum[h[n - j, k - 1, Max[m, j], Join[{j}, l]], {j, Max[1, m], n}] + h[n, k - 1, m, Join[{0}, l]]]];
b[l_] := b[l] = If[Complement[l, {0}] == {}, 1, Sum[If[g[l, i], b[ReplacePart[l, i -> l[[i]] - 1]], 0], {i, 1, Length[l]}]];
g[l_, i_] := Module[{j}, If[l[[i]] < 1, Return[False], If[l[[i]] > 1, For[j = i + 1, j <= Length[l], j++, If[l[[i]] <= l[[j]], Return[False], If[l[[j]] > 0, Break[]]]]]]; True];
a[n_] := h[n, n, 0, {}];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 15}] (* Jean-François Alcover, Jun 01 2022, after Alois P. Heinz *)