A335837
Number of normal patterns matched by integer partitions of n.
Original entry on oeis.org
1, 2, 5, 9, 18, 31, 54, 89, 146, 228, 358, 545, 821, 1219, 1795, 2596, 3741, 5323, 7521, 10534, 14659, 20232, 27788, 37897, 51410, 69347, 93111, 124348, 165378, 218924, 288646, 379021, 495864, 646272, 839490, 1086693, 1402268, 1803786, 2313498, 2958530, 3773093
Offset: 0
The a(0) = 1 through a(4) = 18 pairs of a partition with a matched pattern:
()/() (1)/() (2)/() (3)/() (4)/()
(1)/(1) (2)/(1) (3)/(1) (4)/(1)
(11)/() (21)/() (31)/()
(11)/(1) (21)/(1) (31)/(1)
(11)/(11) (21)/(21) (31)/(21)
(111)/() (22)/()
(111)/(1) (22)/(1)
(111)/(11) (22)/(11)
(111)/(111) (211)/()
(211)/(1)
(211)/(11)
(211)/(21)
(211)/(211)
(1111)/()
(1111)/(1)
(1111)/(11)
(1111)/(111)
(1111)/(1111)
The version for compositions in standard order is
A335454.
The version for compositions is
A335456.
The version for Heinz numbers of partitions is
A335549.
Patterns contiguously matched by prime indices are
A335516.
Contiguous divisors are counted by
A335519.
Minimal patterns avoided by prime indices are counted by
A335550.
-
mstype[q_]:=q/.Table[Union[q][[i]]->i,{i,Length[Union[q]]}];
Table[Sum[Length[Union[mstype/@Subsets[y]]],{y,IntegerPartitions[n]}],{n,0,8}]
-
lista(n) = {
my(v=vector(n+1,i,1+x*O(x^n)));
for(k=1,n,
v=vector(n\(k+1)+1,i,
(1-x^(i*k))/(1-x^k)*v[i] + sum(j=i,n\k,x^(j*k)*v[j+1]) +
x^(k*i)/(1-x^k)^2*v[1] ) );
Vec(v[1]) } \\ Christian Sievers, May 08 2025
a(18) corrected by and a(19)-a(22) from
Jinyuan Wang, Jun 27 2020
A356116
Triangle read by row. The reduced triangle of the partition_triangle A355776.
Original entry on oeis.org
0, 0, 0, 0, 1, 0, 0, 5, 5, 0, 0, 16, 46, 16, 0, 0, 42, 252, 252, 42, 0, 0, 99, 1086, 2241, 1086, 99, 0, 0, 219, 4097, 15129, 15129, 4097, 219, 0, 0, 466, 14272, 87058, 154426, 87058, 14272, 466, 0, 0, 968, 47300, 452672, 1305062, 1305062, 452672, 47300, 968, 0
Offset: 1
Triangle T(n, k) starts:
[1] [0]
[2] [0, 0]
[3] [0, 1, 0]
[4] [0, 5, 5, 0]
[5] [0, 16, 46, 16, 0]
[6] [0, 42, 252, 252, 42, 0]
[7] [0, 99, 1086, 2241, 1086, 99, 0]
[8] [0, 219, 4097, 15129, 15129, 4097, 219, 0]
[9] [0, 466, 14272, 87058, 154426, 87058, 14272, 466, 0]
[10][0, 968, 47300, 452672, 1305062, 1305062, 452672, 47300, 968, 0]
.
Row 6 of the partition triangle A355776 is:
[0, [10, 20, 12], [61, 162, 29], [102, 150], 42, 0]
Adding the bracketed terms reduces this row to row 6 of the above triangle.
-
from functools import cache
@cache
def Pn(n: int, k: int) -> int:
if k == 0: return 0
if n == 0 or k == 1: return 1
return Pn(n, k - 1) + Pn(n - k, k) if k <= n else Pn(n, k - 1)
def reduce_parts(fun, n: int) -> list[int]:
funn: list[int] = fun(n)
return [sum(funn[Pn(n, k):Pn(n, k + 1)]) for k in range(n)]
def reduce_partition_triangle(fun, n: int) -> list[list[int]]:
return [reduce_parts(fun, k) for k in range(1, n)]
reduce_partition_triangle(A355776_row, 6)
A158432
Number of permutations of 1..n containing the relative rank sequence { 45312 } at any spacing.
Original entry on oeis.org
1, 26, 458, 6996, 101072, 1438112, 20598112, 300892896, 4521034917, 70286670034, 1135485759114, 19121776482564, 336412530327804, 6191800556586104, 119301546930406184, 2406376964044265344, 50786085223779295344, 1120447461653440780128, 25810064637612342838624
Offset: 5
-
h:= proc(l) local n; n:=nops(l); add(i, i=l)! /mul(mul(1+l[i]-j
+add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= (n, i, l)-> `if`(n=0 or i=1, h([l[], 1$n])^2, `if`(i<1, 0,
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i))):
a:= n-> n! -g(n, 4, []):
seq(a(n), n=5..25); # Alois P. Heinz, Jul 05 2012
# second Maple program
a:= proc(n) option remember; `if`(n<5, 0, `if`(n=5, 1,
((132-142*n-301*n^2-35*n^3+25*n^4+n^5)*a(n-1)
-2*(10*n^3+33*n^2-181*n-2)*(n-1)^2*a(n-2)
+64*(n-2)^2*(n-1)^3*a(n-3))/ ((n+4)*(n-5)*(n+3)^2)))
end:
seq(a(n), n=5..30); # Alois P. Heinz, Sep 26 2012
-
h[l_] := With[{n = Length[l]}, Sum[i, {i, l}]!/Product[Product[1+l[[i]] - j + Sum[If[l[[k]] >= j, 1, 0], {k, i+1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
g[n_, i_, l_] := If[n == 0 || i === 1, h[Join[l, Array[1 &, n]]]^2, If[i < 1, 0, Sum[g[n - i*j, i - 1, Join[l, Array[i &, j]]], {j, 0, n/i}]]];
a[n_] := n! - g[n, 4, {}];
Table[a[n], {n, 5, 25}] (* Jean-François Alcover, Jun 19 2018, after Alois P. Heinz's first program *)
A159139
Number of permutations of 1..n containing the relative rank sequence { 213465 } at any spacing.
Original entry on oeis.org
1, 37, 891, 18043, 337210, 6081686, 108469917, 1941309261, 35187952132, 649951312000, 12286366975723, 238445927000811, 4762398793018878, 98074791689121162, 2085684931155975120, 45859509146309390064, 1043533983233372354613, 24590543663448304800169
Offset: 6
-
h:= proc(l) local n; n:=nops(l); add(i, i=l)! /mul(mul(1+l[i]-j
+add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= proc(n, i, l)
`if`(n=0 or i=1, h([l[], 1$n])^2, `if`(i<1, 0,
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i)))
end:
a:= n-> n! -g(n, 5, []):
seq(a(n), n=6..30); # Alois P. Heinz, Jul 05 2012
# second Maple program
a:= proc(n) option remember; `if`(n<6, 0, `if`(n=6, 1,
((2475-4819*n^2-2985*n+175*n^4-1021*n^3+n^6+49*n^5)*a(n-1)
-(35*n^4+441*n^3-845*n^2-4147*n-489)*(n-1)^2*a(n-2)
+(-1668+329*n+259*n^2)*(n-1)^2*(n-2)^2*a(n-3)
-225*(n-1)^2*(n-2)^2*(n-3)^2*a(n-4))/ ((n-6)*(n+6)^2*(n+4)^2)))
end:
seq(a(n), n=6..30); # Alois P. Heinz, Sep 26 2012
-
h[l_] := With[{n = Length[l]}, Sum[i, {i, l}]!/Product[Product[1+l[[i]] - j + Sum[If[l[[k]] >= j, 1, 0], {k, i+1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
g[n_, i_, l_] := If[n == 0 || i === 1, h[Join[l, Array[1 &, n]]]^2, If[i < 1, 0, Sum[g[n - i*j, i - 1, Join[l, Array[i &, j]]], {j, 0, n/i}]]];
a[n_] := n! - g[n, 5, {}];
Table[a[n], {n, 6, 30}] (* Jean-François Alcover, Jun 19 2018, from first Maple program *)
A159175
Number of permutations of 1..n containing the relative rank sequence { 1234567 } at any spacing.
Original entry on oeis.org
1, 50, 1578, 40884, 958809, 21353634, 463945294, 9996042284, 215831724525, 4702905606350, 103912444955422, 2336099774748540, 53567906041439136, 1255172323669315848, 30095426182382305848, 739238316780966277616, 18619024923770934306358, 481234428294016650524172
Offset: 7
-
h:= proc(l) local n; n:=nops(l); add(i, i=l)! /mul(mul(1+l[i]-j
+add(`if`(l[k]>=j, 1, 0), k=i+1..n), j=1..l[i]), i=1..n)
end:
g:= (n, i, l)-> `if`(n=0 or i=1, h([l[], 1$n])^2, `if`(i<1, 0,
add(g(n-i*j, i-1, [l[], i$j]), j=0..n/i))):
a:= n-> n! -g(n, 6, []):
seq(a(n), n=7..25); # Alois P. Heinz, Jul 05 2012
# second Maple program
a:= proc(n) option remember; `if`(n<7, 0, `if`(n=7, 1, ((-93464*n+1072*n^4
+72128-125284*n^2+84*n^6+994*n^5-30491*n^3+n^7) *a(n-1)
-4*(14*n^5+399*n^4+1124*n^3-7354*n^2-23983*n-5042)*(n-1)^2 *a(n-2)
+4*(-7359-2629*n+1596*n^2+196*n^3)*(n-1)^2*(n-2)^2 *a(n-3)
-1152*(1+2*n)*(n-1)^2*(n-2)^2*(n-3)^2 *a(n-4))/
((n-7)*(n+9)*(n+8)^2*(n+5)^2)))
end:
seq(a(n), n=7..30); # Alois P. Heinz, Sep 27 2012
-
h[l_] := With[{n = Length[l]}, Sum[i, {i, l}]!/Product[Product[1+l[[i]] - j + Sum[If[l[[k]] >= j, 1, 0], {k, i+1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
g[n_, i_, l_] := If[n == 0 || i === 1, h[Join[l, Array[1 &, n]]]^2, If[i < 1, 0, Sum[g[n - i*j, i - 1, Join[l, Array[i &, j]]], {j, 0, n/i}]]];
a[n_] := n! - g[n, 6, {}];
Table[a[n], {n, 7, 25}] (* Jean-François Alcover, Jun 19 2018, from first Maple program *)
A335447
Number of (1,2)-matching permutations of the prime indices of n.
Original entry on oeis.org
0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0, 1, 1, 0, 0, 2, 0, 2, 1, 1, 0, 3, 0, 1, 0, 2, 0, 5, 0, 0, 1, 1, 1, 5, 0, 1, 1, 3, 0, 5, 0, 2, 2, 1, 0, 4, 0, 2, 1, 2, 0, 3, 1, 3, 1, 1, 0, 11, 0, 1, 2, 0, 1, 5, 0, 2, 1, 5, 0, 9, 0, 1, 2, 2, 1, 5, 0, 4, 0, 1, 0, 11, 1, 1
Offset: 1
The a(n) permutations for n = 6, 12, 24, 48, 30, 72, 60:
(12) (112) (1112) (11112) (123) (11122) (1123)
(121) (1121) (11121) (132) (11212) (1132)
(1211) (11211) (213) (11221) (1213)
(12111) (231) (12112) (1231)
(312) (12121) (1312)
(12211) (1321)
(21112) (2113)
(21121) (2131)
(21211) (2311)
(3112)
(3121)
(1,2)-matching patterns are counted by
A002051.
Permutations of prime indices are counted by
A008480.
(1,2)-matching compositions are counted by
A056823.
STC-numbers of permutations of prime indices are
A333221.
Patterns matched by standard compositions are counted by
A335454.
(1,2,1) or (2,1,2)-matching permutations of prime indices are
A335460.
(1,2,1) and (2,1,2)-matching permutations of prime indices are
A335462.
Dimensions of downsets of standard compositions are
A335465.
(1,2)-matching compositions are ranked by
A335485.
-
primeMS[n_]:=If[n==1,{},Flatten[Cases[FactorInteger[n],{p_,k_}:>Table[PrimePi[p],{k}]]]];
Table[Length[Select[Permutations[primeMS[n]],!GreaterEqual@@#&]],{n,100}]
A335476
Numbers k such that the k-th composition in standard order (A066099) matches the pattern (1,1,2).
Original entry on oeis.org
14, 28, 29, 30, 46, 54, 56, 57, 58, 59, 60, 61, 62, 78, 84, 92, 93, 94, 102, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 142, 156, 157, 158, 168, 169, 172, 174, 180, 182, 184, 185, 186, 187, 188, 189, 190, 198, 204
Offset: 1
The sequence of terms together with the corresponding compositions begins:
14: (1,1,2)
28: (1,1,3)
29: (1,1,2,1)
30: (1,1,1,2)
46: (2,1,1,2)
54: (1,2,1,2)
56: (1,1,4)
57: (1,1,3,1)
58: (1,1,2,2)
59: (1,1,2,1,1)
60: (1,1,1,3)
61: (1,1,1,2,1)
62: (1,1,1,1,2)
78: (3,1,1,2)
84: (2,2,3)
The complement
A335522 is the avoiding version.
The (2,1,1)-matching version is
A335478.
Patterns matching this pattern are counted by
A335509 (by length).
Permutations of prime indices matching this pattern are counted by
A335446.
These compositions are counted by
A335470 (by sum).
Non-unimodal compositions are counted by
A115981 and ranked by
A335373.
Combinatory separations are counted by
A269134.
Patterns matched by standard compositions are counted by
A335454.
Minimal patterns avoided by a standard composition are counted by
A335465.
-
stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
Select[Range[0,100],MatchQ[stc[#],{_,x_,_,x_,_,y_,_}/;x
A335477
Numbers k such that the k-th composition in standard order (A066099) matches the pattern (2,2,1).
Original entry on oeis.org
21, 43, 45, 53, 73, 85, 86, 87, 91, 93, 107, 109, 117, 146, 147, 149, 153, 165, 169, 171, 172, 173, 174, 175, 181, 182, 183, 187, 189, 201, 213, 214, 215, 219, 221, 235, 237, 245, 273, 277, 293, 294, 295, 297, 299, 301, 306, 307, 309, 313, 325, 329, 331, 333
Offset: 1
The sequence of terms together with the corresponding compositions begins:
21: (2,2,1)
43: (2,2,1,1)
45: (2,1,2,1)
53: (1,2,2,1)
73: (3,3,1)
85: (2,2,2,1)
86: (2,2,1,2)
87: (2,2,1,1,1)
91: (2,1,2,1,1)
93: (2,1,1,2,1)
107: (1,2,2,1,1)
109: (1,2,1,2,1)
117: (1,1,2,2,1)
146: (3,3,2)
147: (3,3,1,1)
The complement
A335524 is the avoiding version.
The (1,2,2)-matching version is
A335475.
Patterns matching this pattern are counted by
A335509 (by length).
Permutations of prime indices matching this pattern are counted by
A335453.
These compositions are counted by
A335472 (by sum).
Non-unimodal compositions are counted by
A115981 and ranked by
A335373.
Combinatory separations are counted by
A269134.
Patterns matched by standard compositions are counted by
A335454.
Minimal patterns avoided by a standard composition are counted by
A335465.
-
stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
Select[Range[0,100],MatchQ[stc[#],{_,x_,_,x_,_,y_,_}/;x>y]&]
A355776
Partition triangle read by rows. A statistic of permutations whose Lehmer code is nonmonotonic, refining triangle A356116.
Original entry on oeis.org
0, 0, 0, 0, 0, 1, 0, 0, 3, 2, 5, 0, 0, 6, 10, 22, 24, 16, 0, 0, 10, 20, 12, 61, 162, 29, 102, 150, 42, 0, 0, 15, 35, 49, 135, 432, 246, 273, 391, 1389, 461, 388, 698, 99, 0, 0, 21, 56, 90, 52, 260, 982, 1288, 740, 827, 1150, 4974, 2745, 5778, 482, 2057, 8924, 4148, 1333, 2764, 219, 0
Offset: 0
Table T(n, k) starts:
[0] 0;
[1] 0;
[2] 0, 0;
[3] 0, 1, 0;
[4] 0, [3, 2], 5, 0;
[5] 0, [6, 10], [22, 24], 16, 0;
[6] 0, [10, 20, 12], [61, 162, 29], [102, 150], 42, 0;
[7] 0, [15, 35, 49], [135, 432, 246, 273], [391, 1389, 461], [388, 698], 99, 0;
Summing the bracketed terms reduces the triangle to A356116.
.
The permutations whose Lehmer code is nonmonotonic, in the case n = 4, k = 1 are: 1243, 1324, 1423, which map to the partition [3, 1] and 1342, 2143, which map to the partition [2, 2]. Thus A356116(4, 1) = 3 + 2 = 5.
.
The cardinality of the preimage of the partitions, i.e. the number of permutations whose Lehmer code is nonmonotonic, are the terms of the sequence. Here row 6:
[6] => 0
[5, 1] => 10
[4, 2] => 20
[3, 3] => 12
[4, 1, 1] => 61
[3, 2, 1] => 162
[2, 2, 2] => 29
[3, 1, 1, 1] => 102
[2, 2, 1, 1] => 150
[2, 1, 1, 1, 1] => 42
[1, 1, 1, 1, 1, 1] => 0
-
import collections
def perm_lehmer_nonmono_stats(n):
res = collections.defaultdict(int)
for p in Permutations(n):
l = p.to_lehmer_code()
if all(x >= y for x, y in zip(l, l[1:])): continue
c = [l.count(i) for i in range(len(p)) if i in l]
res[Partition(reversed(sorted(c)))] += 1
return sorted(res.items(), key=lambda x: len(x[0]))
@cached_function
def A355776_row(n):
if n < 2: return [0]
S = perm_lehmer_nonmono_stats(n)
return [0] + [s[1] for s in S] + [0]
def A355776(n, k): return A355776_row(n)[k] if n > 0 else 0
for n in range(0, 8): print(A355776_row(n))
A335478
Numbers k such that the k-th composition in standard order (A066099) matches the pattern (2,1,1).
Original entry on oeis.org
11, 19, 23, 27, 35, 39, 43, 45, 46, 47, 51, 55, 59, 67, 71, 74, 75, 77, 78, 79, 83, 87, 89, 91, 92, 93, 94, 95, 99, 103, 107, 109, 110, 111, 115, 119, 123, 131, 135, 138, 139, 141, 142, 143, 147, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 163, 167, 171
Offset: 1
The sequence of terms together with the corresponding compositions begins:
11: (2,1,1)
19: (3,1,1)
23: (2,1,1,1)
27: (1,2,1,1)
35: (4,1,1)
39: (3,1,1,1)
43: (2,2,1,1)
45: (2,1,2,1)
46: (2,1,1,2)
47: (2,1,1,1,1)
51: (1,3,1,1)
55: (1,2,1,1,1)
59: (1,1,2,1,1)
67: (5,1,1)
71: (4,1,1,1)
The complement
A335523 is the avoiding version.
The (1,1,2)-matching version is
A335476.
Patterns matching this pattern are counted by
A335509 (by length).
Permutations of prime indices matching this pattern are counted by
A335516.
These compositions are counted by
A335470 (by sum).
Non-unimodal compositions are counted by
A115981 and ranked by
A335373.
Combinatory separations are counted by
A269134.
Patterns matched by standard compositions are counted by
A335454.
Minimal patterns avoided by a standard composition are counted by
A335465.
Cf.
A034691,
A056986,
A108917,
A114994,
A238279,
A333224,
A333257,
A335446,
A335456,
A335458,
A335475.
-
stc[n_]:=Reverse[Differences[Prepend[Join@@Position[Reverse[IntegerDigits[n,2]],1],0]]];
Select[Range[0,100],MatchQ[stc[#],{_,x_,_,y_,_,y_,_}/;x>y]&]
Comments