Skip to content

TreeFactorial ​

BinaryTree: The product, over the nodes, of the number of nodes at or below each. OrderedTree: The product, over the vertices, of the number of vertices at or below each.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000411via BinaryTree✓St000410via OrderedTree✓
TreeFactorial(tree)BinaryTree: The product, over the nodes, of the number of nodes at or below each. OrderedTree: The product, over the vertices, of the number of vertices at or below each.
Typed signatures
TypePackageApplies
(binary_tree | ordered_tree) -> numbercombinatoricsalways

Domain: Tree statistics

Details
  • Defined over BinaryTree as an expression in _x, evaluated by compute-engine — the definition IS the implementation.
  • Takes a BinaryTree and nothing else — it reads values against their positions, or walks the orbits, so it needs the bijection. Applying it to a bare list is a type error, not a wrong answer.
  • Defined over OrderedTree as an expression in _x, evaluated by compute-engine — the definition IS the implementation.
  • Takes a OrderedTree and nothing else — it reads values against their positions, or walks the orbits, so it needs the bijection. Applying it to a bare list is a type error, not a wrong answer.

Definition

Epsil, as the implementation runs it.

on BinaryTree, over _x

Apply(
       Function(1 if f in Integers else (Length(Flatten([f])) - 1) * self(
                                                                           self,
                                                                           f[1],
                                                                         ) *
                                        self(self, f[2]), self, f),
       Function(1 if f in Integers else (Length(Flatten([f])) - 1) * self(
                                                                           self,
                                                                           f[1],
                                                                         ) *
                                        self(self, f[2]), self, f),
       _x,
     )

on OrderedTree, over _x

Apply(
       Function([1, 1] if Length(t) == 0 else Apply(
                                                     (r: collection) => [1 +
                                                                         r[1], (1 +
                                                                            r[1]) *
                                                                           r[2]],
                                                     Fold(
                                                           Function([
                                                                      a[1] +
                                                                      b[1],
                                                                      a[2] *
                                                                      b[2],
                                                                    ], a, b),
                                                           [0, 1],
                                                           Map(Function(
                                                                         self(self, c),
                                                                         c,
                                                                       ), t),
                                                         ),
                                                   ), self, t),
       Function([1, 1] if Length(t) == 0 else Apply(
                                                     (r: collection) => [1 +
                                                                         r[1], (1 +
                                                                            r[1]) *
                                                                           r[2]],
                                                     Fold(
                                                           Function([
                                                                      a[1] +
                                                                      b[1],
                                                                      a[2] *
                                                                      b[2],
                                                                    ], a, b),
                                                           [0, 1],
                                                           Map(Function(
                                                                         self(self, c),
                                                                         c,
                                                                       ), t),
                                                         ),
                                                   ), self, t),
       _x,
     )[2]

Examples

Basic #

the binary tree [[.,.],[[.,.],.]][[.,.],[[.,.],.]]

live ↗
InTreeFactorial(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{TreeFactorial}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out88

the ordered tree [[],[[]],[]][[],[[]],[]]

live ↗
InTreeFactorial(OrderedTree⁡([[],[[]],[]]))\mathrm{TreeFactorial}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack))Out1010
Properties #

FindStat's value for [.,[.,.]]

live ↗
InCombinatorialStat(BinaryTree⁡([0,[0,0]]),TreeFactorial)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack0, \bigl\lbrack0, 0\bigr\rbrack\bigr\rbrack), \text{TreeFactorial})Out22

Known value · FindStat St000411

FindStat's value for [[.,.],.]

live ↗
InCombinatorialStat(BinaryTree⁡([[0,0],0]),TreeFactorial)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack), \text{TreeFactorial})Out22

Known value · FindStat St000411

FindStat's value for [.,[.,[.,.]]]

live ↗
InCombinatorialStat(BinaryTree⁡([0,[0,[0,0]]]),TreeFactorial)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack0, \bigl\lbrack0, \bigl\lbrack0, 0\bigr\rbrack\bigr\rbrack\bigr\rbrack), \text{TreeFactorial})Out66

Known value · FindStat St000411

FindStat's value for [[]]

live ↗
InCombinatorialStat(OrderedTree⁡([[]]),TreeFactorial)\mathrm{CombinatorialStat}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack), \text{TreeFactorial})Out22

Known value · FindStat St000410

FindStat's value for [[[]]]

live ↗
InCombinatorialStat(OrderedTree⁡([[[]]]),TreeFactorial)\mathrm{CombinatorialStat}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack\bigr\rbrack), \text{TreeFactorial})Out66

Known value · FindStat St000410

FindStat's value for [[],[]]

live ↗
InCombinatorialStat(OrderedTree⁡([[],[]]),TreeFactorial)\mathrm{CombinatorialStat}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack), \text{TreeFactorial})Out33

Known value · FindStat St000410

About
Examples8
Checked againstSageMath 6 agree
CrosswalkFindStat ×2