Skip to content

NonNestingPartitions ​

The partitions of {1,…,n}\{1, …, n\} with no two blocks whose consecutive-element arcs nest.

NonNestingPartitions(n)the partitions of {1,…,n}\{1, …, n\} with no two blocks whose consecutive-element arcs nest
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<set_partition>combinatoricsalways

Domain: Collections

Details
  • Count is the Catalan number CnC_n (A000108).

Definition

Epsil, as the implementation runs it.

count(_n)

Apply((bd: integer) => 0 if 2 * _n < 0 || (2 * _n - 0) % 2 == 1 else Binomial(2 *
                                                                              _n, bd) -
                                                                     (0 if bd ==
                                                                           0 else Binomial(2 * _n, bd - 1)), (2 * _n -
                                                                        0 - (2 *
                                                                            _n - 0) %
                                                                           2) / 2)

unrank(_n, _r)

Apply(
       (tz: list<integer>) => Apply((tlab: list<integer>) => Map(
                                                                  Function(Filter(
                                                                                   Range(1, _n, 1),
                                                                                   Function(tlab[p] == j, p),
                                                                                 ), j),
                                                                  Range(
                                                                         0,
                                                                         tz[2] -
                                                                         1,
                                                                         1,
                                                                       ),
                                                                ), Drop(tz, 3 +
                                                                           tz[3])),
       Apply((ts_init: list<integer>) => Fold((ts: list<integer>, ti) => Apply(
                                                                                (ts_next: list<integer>) => ts_next,
                                                                                Apply((tu: list<integer>) => Apply((tr: integer) => Apply((tb: integer) => Apply((ta: integer) => Apply((tt: integer) => Apply(
                                                                                                                                                                                                                (tl: list<integer>) => Apply((tw: list<integer>) => Apply(
                                                                                                                                                                                                                                                                           (to: integer) => Join([tr, tb + 1, ta + 1], tl, [tb], tw, [tb]) if tr < to else Apply(
                                                                                                                                                                                                                                                                                                                                                                  (tf: list<integer>) => Apply((tj: integer) => Apply((tc: integer) => Apply((tk: list<integer>) => Join([tf[1], tb, Length(tk) + 1], tk, [tc], tw, [tc]), Drop(tl, tj)), tl[tj]), tf[2]),
                                                                                                                                                                                                                                                                                                                                                                  Apply((tg_init: list<integer>) => Fold((tg: list<integer>, tq) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                           (tg_next: list<integer>) => tg_next,
                                                                                                                                                                                                                                                                                                                                                                                                                                           tg if 0 < tg[2] else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (tx: integer) => [tg[1], tq] if tg[1] < tx else [tg[1] - tx, 0],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       _tables[(tt - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (_n + 2) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ta - tq +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1 +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ),
                                                                                                                                                                                                                                                                                                                                                                                                                                         ), tg_init, Range(1, ta, 1)), [tr - to, 0]),
                                                                                                                                                                                                                                                                                                                                                                ),
                                                                                                                                                                                                                                                                           _tables[(tt - 1) *
                                                                                                                                                                                                                                                                                   (_n + 2) +
                                                                                                                                                                                                                                                                                   ta + 1 +
                                                                                                                                                                                                                                                                                   1],
                                                                                                                                                                                                                                                                         ), Drop(tu, 3 + ta)),
                                                                                                                                                                                                                Take(Drop(tu, 3), ta),
                                                                                                                                                                                                              ), _n + 1 -
                                                                                                                                                                                                                ti), tu[3]), tu[2]), tu[1]), ts),
                                                                              ), ts_init, Range(1, _n, 1)), [_r, 0, 0]),
     )

rank(_n, _x)

Apply((lb: list<integer>) => Apply(
                                    (pr: list<integer>) => Fold(Function(
                                                                          Apply((ru: list<integer>) => Apply((rp: integer) => Apply((ra: integer) => Apply(
                                                                                                                                                            (rt: integer) => Apply((rl: list<integer>) => Apply(
                                                                                                                                                                                                                 (rj: integer) => Join(ru, [ri]) if rp == 0 else Join([ru[1] +
                                                                                                                                                                                                                                                                       _tables[(rt - 1) *
                                                                                                                                                                                                                                                                               (_n + 2) +
                                                                                                                                                                                                                                                                               ra + 1 +
                                                                                                                                                                                                                                                                               1] +
                                                                                                                                                                                                                                                                       Fold(Function(rw +
                                                                                                                                                                                                                                                                                     _tables[(rt - 1) *
                                                                                                                                                                                                                                                                                             (_n + 2) +
                                                                                                                                                                                                                                                                                             ra - rk +
                                                                                                                                                                                                                                                                                             1 +
                                                                                                                                                                                                                                                                                             1], rw, rk), 0, Range(1, rj - 1, 1))], Drop(rl, rj), [ri]),
                                                                                                                                                                                                                 1 +
                                                                                                                                                                                                                 Count(Filter(rl, Function(rv < rp, rv))),
                                                                                                                                                                                                               ), Drop(ru, 1)),
                                                                                                                                                            _n + 1 -
                                                                                                                                                            ri,
                                                                                                                                                          ), Length(ru) - 1), pr[ri]), rs),
                                                                          rs,
                                                                          ri,
                                                                        ), [0], Range(1, _n, 1))[1],
                                    Map(Function(
                                                  Fold(Function(
                                                                 ez if lb[ez] ==
                                                                       lb[ei] else ea,
                                                                 ea,
                                                                 ez,
                                                               ), 0, Range(
                                                                           1,
                                                                           ei -
                                                                           1,
                                                                           1,
                                                                         )),
                                                  ei,
                                                ), Range(1, _n, 1)),
                                  ), Map(Function(Fold(
                                                       Function(la +
                                                                (lj if Contains(_x[lj], lx) else 0), la, lj),
                                                       0,
                                                       Range(1, Length(_x), 1),
                                                     ), lx), Range(1, _n, 1)))

valid(_n, _x)

Apply((flat: list<integer>) => Length(flat) == _n &&
                               Fold(Function(
                                              ok_blk && Length(blk) >= 1,
                                              ok_blk,
                                              blk,
                                            ), True, _x) && Fold(
                                                                 Function(ok_x &&
                                                                          Contains(flat, x), ok_x, x),
                                                                 True,
                                                                 Range(1, _n, 1),
                                                               ), Flatten(_x)) && Apply(
                                                        (lb: list<integer>) => Apply(
                                                                                      (pr: list<integer>) => Fold(
                                                                                                                   Function(ok_vi &&
                                                                                                                            Fold(Function(ok_vk &&
                                                                                                                                          !(0 < pr[vi] &&
                                                                                                                                            0 < pr[vk] &&
                                                                                                                                            pr[vi] < pr[vk] &&
                                                                                                                                            vk < vi), ok_vk, vk), True, Range(1, _n, 1)), ok_vi, vi),
                                                                                                                   True,
                                                                                                                   Range(1, _n, 1),
                                                                                                                 ),
                                                                                      Map(
                                                                                           Function(Fold(
                                                                                                          Function(ez if lb[ez] == lb[ei] else ea, ea, ez),
                                                                                                          0,
                                                                                                          Range(1, ei - 1, 1),
                                                                                                        ), ei),
                                                                                           Range(1, _n, 1),
                                                                                         ),
                                                                                    ),
                                                        Map(
                                                             Function(Fold(
                                                                            Function(la +
                                                                                     (lj if Contains(_x[lj], lx) else 0), la, lj),
                                                                            0,
                                                                            Range(1, Length(_x), 1),
                                                                          ), lx),
                                                             Range(1, _n, 1),
                                                           ),
                                                      )

tables(_n)

Fold(
      Function(
                Join(
                      g_t,
                      Fold(
                            Function(
                                      ReplaceAt(
                                                 g_row,
                                                 g_c + 1,
                                                 (g_t[(g_s - 1) * (_n + 2) + g_c +
                                                                             1 +
                                                      1] if g_c + 1 < _n + 2 else 0) +
                                                 Fold(
                                                       Function(
                                                                 gs + g_t[(g_s -
                                                                           1) *
                                                                          (_n +
                                                                           2) +
                                                                          gm + 1],
                                                                 gs,
                                                                 gm,
                                                               ),
                                                       0,
                                                       Range(1, g_c, 1),
                                                     ),
                                               ),
                                      g_row,
                                      g_c,
                                    ),
                            Map(Function(0, g_z), Range(0, _n + 2 - 1, 1)),
                            Range(0, _n + 2 - 1, 1),
                          ),
                    ),
                g_t,
                g_s,
              ),
      Fold(
            Function(ReplaceAt(g_row, g_c + 1, 1), g_row, g_c),
            Map(Function(0, g_z), Range(0, _n + 2 - 1, 1)),
            Range(0, _n + 2 - 1, 1),
          ),
      Range(1, _n + 1 - 1, 1),
    )

Statistics

On SetPartition, called as CombinatorialStat(x, "Name").

Maps

Into and out of SetPartition, called as CombinatorialMap(x, "Name"). Properties are the laws we state and what FindStat records.

From SetPartition

  • ArcRepresentationSetPartition → EndofunctionEach position linked to the next in its block, or to itself when last.
  • AssociatedStandardTableauSetPartition → StandardTableauSurjectionMp00258The standard tableau whose j-th column holds the j-th smallest elements of the blocks, in increasing order.
  • BlockSizeCompositionSetPartition → IntegerCompositionsurjectionSurjectionGraded mapMp00128The block sizes of a set partition, its blocks taken in order of their least elements.
  • BlockSizePartitionSetPartition → IntegerPartitionsurjectionSurjectionGraded mapMp00079The partition of n a set partition's block sizes form, largest first.
  • CallanSwitchSetPartition → SetPartitionBijectionGraded mapInvolutionMp00249Callan's involution: switches the first closer with the lesser of the least closer and the second element of the block of 1.
  • ComplementSetPartition → SetPartitioninvolutionBijectionGraded mapInvolutionMp00112Each element i replaced by n + 1 - i: the set partition seen from the other end.
  • DecreasingRotationSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00176Every element lowered by one, cyclically: 1 becomes the largest.
  • DualMajorIndexToIntertwiningSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00174The inverse of IntertwiningToDualMajorIndex: read the growth word as an intertwining word and rebuild the blocks.
  • IncreasingCyclePermutationSetPartition → PermutationInjectionGraded mapMp00080The permutation whose cycles are the blocks, each cycle increasing: every element goes to the next larger in its block, the largest to the least.
  • IncreasingRotationSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00091Every element raised by one, cyclically: the largest becomes 1.
  • IntertwiningToDualMajorIndexSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00171The set partition whose growth word is the intertwining word: a bijection taking the intertwining number to the dual major index.
  • InverseWachsWhiteSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00216The set partition joined by the arcs of the rook placement that Wachs and White's bijection gamma assigns to the set partition.
  • InverseWachsWhiteRhoSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00218The set partition joined by the arcs of the rook placement that Wachs and White's bijection rho assigns to the set partition.
  • InverseYipSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00219The set partition joined by the arcs of the rook placement that Yip's bijection psi assigns to the set partition.
  • KasraouiZengSetPartition → SetPartitionBijectionGraded mapInvolutionMp00115The Kasraoui-Zeng involution: exchanges the number of crossings with the number of nestings.
  • RestrictedGrowthStringSetPartition → RestrictedGrowthStringinverseA set partition's restricted growth string: each position labelled with its block's index, from 0.
  • WachsWhiteSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00215The set partition whose arcs, read as a rook placement, Wachs and White's bijection gamma carries to a set partition.
  • WachsWhiteRhoSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00217The set partition whose arcs, read as a rook placement, Wachs and White's bijection rho carries to a set partition.
  • YipSetPartition → SetPartitionbijectioninverseBijectionGraded mapMp00220The set partition whose arcs, read as a rook placement, Yip's bijection psi carries to a set partition.

To SetPartition

  • CyclePartitionPermutation → SetPartitionsurjectionSurjectionGraded mapMp00151The orbits, as a set partition of the positions.
  • NoncrossingPartitionDyckPath → SetPartitionInjectionGraded mapMp00138Biane's noncrossing set partition: the up steps whose matching downs lie in one run of downs form a block.
  • RowSetPartitionStandardTableau → SetPartitionInjectionGraded mapMp00284The set partition whose blocks are the rows of the tableau.
  • SetPartitionRestrictedGrowthString → SetPartitioninverseThe set partition a restricted growth string labels: block j holds the positions labelled j.
  • UnderlyingSetPartitionSetComposition → SetPartitionsurjectionSurjectionGraded mapMp00285The set partition with the same blocks, the order of the blocks forgotten.
  • WeakExceedancePartitionPermutation → SetPartitionSurjectionGraded mapMp00240The coarsest set partition containing every arc from i to π(i) with i ≤ π(i).
3 more in FindStat, not implemented here
  • Mp00092PerfectMatching → SetPartitionInjectionGraded mapto set partition
  • Mp00164SetPartition → SetPartitionBijectionGraded mapInvolutionChen Deng Du Stanley Yan
  • Mp00221SetPartition → SetPartitionBijectionGraded mapInvolutionconjugate

Enumeration

Examples

1 more kept as data, checked against the oracles
Basic #

Count(NonNestingPartitions(4))=14Count(NonNestingPartitions(4)) = 14

live ↗
InCount(NonNestingPartitions(4))\mathrm{Count}(\mathrm{NonNestingPartitions}(4))Out1414

The first element in enumeration order

live ↗
InNonNestingPartitions(4)[1]\mathrm{NonNestingPartitions}(4)[1]OutSetPartition⁡([[1],[2],[3],[4]]){\operatorname{SetPartition}}([[1], [2], [3], [4]])
About
Examples3
CrosswalkOEISSageMath

See also: SetPartitions, NonCrossingPartitions, DyckPaths