Skip to content

Surjections ​

A name from the enumeratio catalogue with no kernel of its own yet; this page carries its crosswalk only.

Catalogued in the enumeratio database, with crosswalk rows in oeis, sage; not yet written up here.

✓ checked against that system · ! checked, with disagreements (hover a chip)OEISA000670A019538A131689✓SageMathOrderedSetPartitions(n)
Surjections(...)Catalogued in the enumeratio database, with crosswalk rows in oeis, sage; not yet written up here.
Typed signatures
TypePackageApplies
(integer<0..>, integer<0..>) -> indexed_collection<surjection>combinatoricsalways

Domain: Combinatorics

Definition

Epsil, as the implementation runs it.

count(_n, _k)

_tables[_n * (_k + 1) + _k + 1]

unrank(_n, _k, _r)

Drop(Fold(Function(Apply(
                          (sw: list<integer>) => Apply((sm: integer) => Apply((sl: integer) => Apply(
                                                                                                      (sc: list<integer>) => Join([sc[1], sc[3]], sw, [sc[2]]),
                                                                                                      Fold(
                                                                                                            Function(sf if 0 < sf[2] else Apply(
                                                                                                                                                 (sn: integer) => [sf[1], c, sm if Contains(sw, c) else sm - 1] if sf[1] < sn else [sf[1] - sn, 0, sm],
                                                                                                                                                 _tables[sl *
                                                                                                                                                         (_k + 1) + sm + 1] if Contains(sw, c) else _tables[sl *
                                                                                                                                                                                                    (_k + 1) +
                                                                                                                                                                                                    (sm - 1) +
                                                                                                                                                                                                    1] if 0 < sm else 0,
                                                                                                                                               ), sf, c),
                                                                                                            [su[1], 0, sm],
                                                                                                            Range(1, _k, 1),
                                                                                                          ),
                                                                                                    ), _n - si), su[2]),
                          Drop(su, 2),
                        ), su, si), [_r, _k], Range(1, _n, 1)), 2)

rank(_n, _k, _x)

Fold(Function(Apply(
                     (sp: list<integer>) => Apply((sm: integer) => Apply((sl: integer) => [
                                                                                            sr[1] +
                                                                                            Fold(
                                                                                                  Function(sb +
                                                                                                           (_tables[sl *
                                                                                                                    (_k + 1) + sm + 1] if Contains(sp, c) else _tables[sl *
                                                                                                                                                               (_k + 1) +
                                                                                                                                                               (sm - 1) +
                                                                                                                                                               1] if 0 < sm else 0), sb, c),
                                                                                                  0,
                                                                                                  Range(1, sx - 1, 1),
                                                                                                ),
                                                                                            sm if Contains(sp, sx) else sm - 1,
                                                                                            sr[3] + 1,
                                                                                          ], _n - sr[3]), sr[2]),
                     Take(_x, sr[3] - 1),
                   ), sr, sx), [0, _k, 1], _x)[1]

valid(_n, _k, _x)

Length(_x) == _n &&
Fold(Function(ok_x && 1 <= x && x <= _k, ok_x, x), True, _x) && Fold(
                                                                      Function(ok_c &&
                                                                               Contains(_x, c), ok_c, c),
                                                                      True,
                                                                      Range(
                                                                             1,
                                                                             _k,
                                                                             1,
                                                                           ),
                                                                    )

tables(_n, _k)

Fold(
      Function(Join(
                     j_t,
                     Fold(
                           Function(ReplaceAt(
                                               j_row,
                                               j_c + 1,
                                               (j_c * j_t[(j_s - 1) * (_k + 1) +
                                                          (j_c - 1) + 1] if 0 < j_c else 0) +
                                               (_k - j_c) * j_t[(j_s - 1) * (_k +
                                                                             1) +
                                                                j_c + 1],
                                             ), j_row, j_c),
                           Map(Function(0, j_z), Range(0, _k + 1 - 1, 1)),
                           Range(0, _k + 1 - 1, 1),
                         ),
                   ), j_t, j_s),
      Fold(
            Function(
                      ReplaceAt(j_row, j_c + 1, 1 if j_c == 0 else 0),
                      j_row,
                      j_c,
                    ),
            Map(Function(0, j_z), Range(0, _k + 1 - 1, 1)),
            Range(0, _k + 1 - 1, 1),
          ),
      Range(1, _n + 1 - 1, 1),
    )

Maps

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

From Surjection

  • SetCompositionSurjection → SetCompositioninverseThe set composition a surjection labels: block j holds the positions labelled j.

To Surjection

  • SurjectionSetComposition → SurjectioninverseA set composition as a surjection: each position labelled with its block's index, from 1.

Examples

Basic #

The surjections from {1,2,3}\{1,2,3\} onto {1,2}\{1,2\}: 2!⋅S(3,2)=62! \cdot S(3,2) = 6

live ↗
InCount(Surjections(3,2))\mathrm{Count}(\mathrm{Surjections}(3, 2))Out66

The surjections as words of length 33 over {1,2}\{1, 2\}

live ↗
InTake(Surjections(3,2),6)\mathrm{Take}(\mathrm{Surjections}(3, 2), 6)Out[Surjection⁡([1,1,2]),Surjection⁡([1,2,1]),Surjection⁡([1,2,2]),Surjection⁡([2,1,1]),Surjection⁡([2,1,2]),Surjection⁡([2,2,1])]\bigl\lbrack{\operatorname{Surjection}}([1, 1, 2]), {\operatorname{Surjection}}([1, 2, 1]), {\operatorname{Surjection}}([1, 2, 2]), {\operatorname{Surjection}}([2, 1, 1]), {\operatorname{Surjection}}([2, 1, 2]), {\operatorname{Surjection}}([2, 2, 1])\bigr\rbrack
About
Examples2
CrosswalkOEIS ×3SageMath