OFFSET
0,6
LINKS
Peter Luschny, Permutations with Lehmer, a SageMath Jupyter Notebook.
EXAMPLE
[0] 0;
[1] 0;
[2] 1, 0;
[3] 1, 2, 0;
[4] 1, [5, 3], 2, 0;
[5] 1, [9, 12], [15, 10], 2, 0;
[6] 1, [14, 23, 12], [ 47, 94, 11], [31, 24], 2, 0;
[7] 1, [20, 38, 48], [113, 293, 154, 137], [183, 409, 78], [63, 54], 2, 0;
Summing the bracketed terms reduces the triangle to A356265.
PROG
(SageMath)
import collections
def reducible(p) -> bool: # p is a Sage-Permutation
return any(i for i in range(1, p.size())
if all(p(j) < p(k)
for j in range(1, i + 1)
for k in range(i + 1, p.size() + 1) ) )
def void(L) -> bool: return True
def perm_red_stats(n: int, part_costraint, lehmer_constraint):
res = collections.defaultdict(int)
for p in Permutations(n):
if not part_costraint(p): continue
l: list[int] = p.to_lehmer_code()
if lehmer_constraint(l):
c: list[int] = [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]))
@cache
def A356264_row(n: int) -> list[int]:
if n < 2: return [0]
return [v[1] for v in perm_red_stats(n, reducible, void)] + [0]
def A356264(n: int, k: int) -> int:
return A356264_row(n)[k]
for n in range(0, 8): print(A356264_row(n))
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Peter Luschny, Aug 05 2022
STATUS
approved