Skip to content

PruferSequences ​

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; not yet written up here.

PruferSequences(...)Catalogued in the enumeratio database, with crosswalk rows in oeis; not yet written up here.
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<prufer_sequence>combinatoricsalways

Domain: Combinatorics

Definition

Epsil, as the implementation runs it.

count(_n)

0 if _n <= 0 else 1 if _n <= 2 else _n ^ (_n - 2)

unrank(_n, _r)

Map(Function((_r - _r % _n ^ (Max(_n - 2, 0) - j)) / _n ^ (Max(_n - 2, 0) - j) %
             _n + 1, j), Range(1, Max(_n - 2, 0), 1))

rank(_n, _x)

Fold(Function(acc * _n + (_x[j] - 1), acc, j), 0, Range(1, Max(_n - 2, 0), 1))

valid(_n, _x)

Length(_x) == Max(_n - 2, 0) && Fold(Function(
                                               ok_j && 1 <= _x[j] && _x[j] <= _n +
                                                                              1 -
                                                                              1,
                                               ok_j,
                                               j,
                                             ), True, Range(1, Length(_x), 1))

Enumeration

Examples

Basic #

53=1255^{3} = 125 labelled trees on 55 vertices: Count of the sequences of length n−2n-2

live ↗
InCount(PruferSequences(5))\mathrm{Count}(\mathrm{PruferSequences}(5))Out125125

The Prüfer sequences of the 33 labelled trees on 33 vertices

live ↗
InTake(PruferSequences(3),3)\mathrm{Take}(\mathrm{PruferSequences}(3), 3)Out[PruferSequence⁡([1]),PruferSequence⁡([2]),PruferSequence⁡([3])]\bigl\lbrack{\operatorname{PruferSequence}}([1]), {\operatorname{PruferSequence}}([2]), {\operatorname{PruferSequence}}([3])\bigr\rbrack
About
Examples2
CrosswalkOEIS