Skip to content

UnlabeledFreeTrees ​

The free (unrooted) trees on nn unlabelled nodes, up to isomorphism.

UnlabeledFreeTrees(n)every tree on nn unlabelled nodes with no distinguished root, one per isomorphism class.
Typed signatures
TypePackageApplies
(integer<0..>) -> indexed_collection<unlabeled_free_tree>combinatoricsalways

Domain: Collections

Details
  • A lazy indexed collection; the count is A000055(n)A000055(n) — A000055(7)=11A000055(7) = 11 — obtained by canonically rooting each free tree at its centroid: every branch must weigh at most ⌊n/2⌋\lfloor n/2 \rfloor, then a correction (T(m)2)\binom{T(m)}{2} (Otter 1948) removes the double count from trees split by a central edge into two non-isomorphic halves.
  • Each element is a level sequence, exactly as for RootedUnlabeledTreesRootedUnlabeledTrees, but rooted at the tree's centroid rather than an arbitrary node.
  • See Binomial for the correction term and RootedUnlabeledTrees for the shared encoding and children-multiset kernel.

Definition

Epsil, as the implementation runs it.

count(_n)

0 if _n < 1 else _tables[(_n - _n % 2) / 2 * Max(_n, 1) + (_n - 1) + 1] if _n %
                                                                           2 == 1 else _tables[((_n -
                                                                                                _n % 2) /
                                                                                               2 -
                                                                                               1) *
                                                                                              Max(_n, 1) +
                                                                                              (_n - 1) +
                                                                                              1] +
                                                                                      Binomial(_tables[((_n -
                                                                                                         _n % 2) /
                                                                                                        2 -
                                                                                                        1) *
                                                                                                       Max(_n, 1) +
                                                                                                       ((_n -
                                                                                                         _n % 2) /
                                                                                                        2 -
                                                                                                        1) +
                                                                                                       1] +
                                                                                               1, 2)

unrank(_n, _r)

Apply((tu_pair: boolean) => Apply(
                                   (tu_a: integer) => Apply(
                                                             (tu_roots: list<integer>) => Take(Apply((tu_s_init: list<integer>) => Fold((tu_s: list<integer>, tu_i) => Apply(
                                                                                                                                                                              (tu_s_next: list<integer>) => tu_s_next,
                                                                                                                                                                              Apply((tu_d: integer) => Apply((tu_w: integer) => Apply((tu_r: integer) => Apply(
                                                                                                                                                                                                                                                                (tu_kids: list<integer>) => Join(Take(tu_s, tu_i - 1), [tu_d], tu_kids, Drop(tu_s, tu_i + 2)),
                                                                                                                                                                                                                                                                Drop(Apply((ts_s_init: list<integer>) => Fold((ts_s: list<integer>, ts_u) => Apply(
                                                                                                                                                                                                                                                                                                                                                    (ts_s_next: list<integer>) => ts_s_next,
                                                                                                                                                                                                                                                                                                                                                    Apply((ts_rem: integer) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                      (ts_sc: list<integer>) => Apply((ts_kk: integer) => Apply((ts_ways: integer) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                             (ts_digits: list<integer>) => Join(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 [ts_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ts_kk * ts_u, ts_sc[3] % ts_ways],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Drop(ts_s, 2),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Apply((ts_found_init: list<integer>) => Fold((ts_found: list<integer>, ts_j) => Apply((ts_found_next: list<integer>) => ts_found_next, Join(ts_found, [tu_d + 1, ts_u, ts_digits[ts_kk + 1 -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ts_j +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  2] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (ts_j - 1)])), ts_found_init, Range(1, ts_kk, 1)), []),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (ts_dg_init: list<integer>) => Fold((ts_dg: list<integer>, ts_i) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (ts_dg_next: list<integer>) => ts_dg_next,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Apply((ts_left: integer) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (ts_top: integer) => Join([ts_left -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             (Binomial(ts_top, ts_i) if 0 <= ts_i &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ts_i <= ts_top else 0), ts_top], Drop(ts_dg, 2), [ts_top]),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         (ts_g_b_init: list<integer>) => Fold((ts_g_b: list<integer>, ts_g_h) => Apply((ts_g_b_next: list<integer>) => ts_g_b_next, Apply((ts_g_mid: integer) => [ts_g_mid, ts_g_b[2]] if (Binomial(ts_g_mid, ts_i) if 0 <= ts_i &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ts_i <= ts_g_mid else 0) <=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ts_left else [ts_g_b[1], ts_g_mid - 1], (ts_g_b[1] + ts_g_b[2] + 1 -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (ts_g_b[1] + ts_g_b[2] + 1) %
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            2) /
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           2) if ts_g_b[1] < ts_g_b[2] else ts_g_b), ts_g_b_init, Range(1, 64, 1)),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         [ts_i - 1, ts_dg[2] - 1],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       )[1],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ), ts_dg[1]),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ), ts_dg_init, Range(ts_kk, 1, -1)),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    [(ts_sc[3] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ts_sc[3] % ts_ways) /
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ts_ways, _tables[(ts_u - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (ts_u - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (ts_kk - 1)],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ), Max(_tables[(ts_u - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         (ts_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ts_kk * ts_u) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         1], 1)), ts_sc[2]),
                                                                                                                                                                                                                                                                                                                                                                                      Apply((ts_sc_init: list<integer>) => Fold((ts_sc: list<integer>, ts_k) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (ts_sc_next: list<integer>) => ts_sc_next,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ts_sc if ts_sc[1] == 1 else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (ts_blk: integer) => [1, ts_k, ts_sc[3]] if ts_sc[3] < ts_blk else [0, ts_k, ts_sc[3] - ts_blk],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Binomial(_tables[(ts_u - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           (ts_u - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   (ts_k - 1), ts_k) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          _tables[(ts_u - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (ts_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ts_k * ts_u) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ), ts_sc_init, Range(0, (ts_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ts_rem % ts_u) /
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ts_u, 1)), [0, 0, ts_s[2]]),
                                                                                                                                                                                                                                                                                                                                                                                    ), ts_s[1]),
                                                                                                                                                                                                                                                                                                                                                  ), ts_s_init, Range(tu_w - 1, 1, -1)), [tu_w - 1, tu_r]), 2),
                                                                                                                                                                                                                                                              ), tu_s[tu_i + 2]), tu_s[tu_i + 1]), tu_s[tu_i]),
                                                                                                                                                                            ), tu_s_init, Range(2, _n, 1)), Join([0], tu_roots)), _n),
                                                             Join(
                                                                   [
                                                                     1,
                                                                     (_n - _n %
                                                                           2) / 2,
                                                                     tu_a,
                                                                   ] if tu_pair else [],
                                                                   Drop(Apply(
                                                                               (tr_s_init: list<integer>) => Fold(
                                                                                                                   (tr_s: list<integer>, tr_u) => Apply(
                                                                                                                                                         (tr_s_next: list<integer>) => tr_s_next,
                                                                                                                                                         Apply((tr_rem: integer) => Apply(
                                                                                                                                                                                           (tr_sc: list<integer>) => Apply((tr_kk: integer) => Apply(
                                                                                                                                                                                                                                                      (tr_ways: integer) => Apply(
                                                                                                                                                                                                                                                                                   (tr_digits: list<integer>) => Join(
                                                                                                                                                                                                                                                                                                                       [tr_rem -
                                                                                                                                                                                                                                                                                                                        tr_kk * tr_u, tr_sc[3] % tr_ways],
                                                                                                                                                                                                                                                                                                                       Drop(tr_s, 2),
                                                                                                                                                                                                                                                                                                                       Apply((tr_found_init: list<integer>) => Fold((tr_found: list<integer>, tr_j) => Apply((tr_found_next: list<integer>) => tr_found_next, Join(tr_found, [1, tr_u, tr_digits[tr_kk + 1 -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tr_j +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 2] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (tr_j - 1)])), tr_found_init, Range(1, tr_kk, 1)), []),
                                                                                                                                                                                                                                                                                                                     ),
                                                                                                                                                                                                                                                                                   Apply(
                                                                                                                                                                                                                                                                                          (tr_dg_init: list<integer>) => Fold((tr_dg: list<integer>, tr_i) => Apply(
                                                                                                                                                                                                                                                                                                                                                                     (tr_dg_next: list<integer>) => tr_dg_next,
                                                                                                                                                                                                                                                                                                                                                                     Apply((tr_left: integer) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                        (tr_top: integer) => Join([tr_left -
                                                                                                                                                                                                                                                                                                                                                                                                                                   (Binomial(tr_top, tr_i) if 0 <= tr_i &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                              tr_i <= tr_top else 0), tr_top], Drop(tr_dg, 2), [tr_top]),
                                                                                                                                                                                                                                                                                                                                                                                                        Apply((tr_g_b_init: list<integer>) => Fold((tr_g_b: list<integer>, tr_g_h) => Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             (tr_g_b_next: list<integer>) => tr_g_b_next,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (tr_g_mid: integer) => [tr_g_mid, tr_g_b[2]] if (Binomial(tr_g_mid, tr_i) if 0 <= tr_i &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tr_i <= tr_g_mid else 0) <=
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tr_left else [tr_g_b[1], tr_g_mid - 1],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (tr_g_b[1] + tr_g_b[2] + 1 -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (tr_g_b[1] + tr_g_b[2] + 1) %
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     2) /
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    2,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ) if tr_g_b[1] < tr_g_b[2] else tr_g_b,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ), tr_g_b_init, Range(1, 64, 1)), [tr_i - 1, tr_dg[2] - 1])[1],
                                                                                                                                                                                                                                                                                                                                                                                                      ), tr_dg[1]),
                                                                                                                                                                                                                                                                                                                                                                   ), tr_dg_init, Range(tr_kk, 1, -1)),
                                                                                                                                                                                                                                                                                          [(tr_sc[3] -
                                                                                                                                                                                                                                                                                            tr_sc[3] % tr_ways) /
                                                                                                                                                                                                                                                                                           tr_ways, _tables[(tr_u - 1) *
                                                                                                                                                                                                                                                                                                     Max(_n, 1) +
                                                                                                                                                                                                                                                                                                     (tr_u - 1) +
                                                                                                                                                                                                                                                                                                     1] +
                                                                                                                                                                                                                                                                                             (tr_kk - 1)],
                                                                                                                                                                                                                                                                                        ),
                                                                                                                                                                                                                                                                                 ),
                                                                                                                                                                                                                                                      Max(_tables[(tr_u - 1) *
                                                                                                                                                                                                                                                                  Max(_n, 1) +
                                                                                                                                                                                                                                                                  (tr_rem -
                                                                                                                                                                                                                                                                   tr_kk * tr_u) +
                                                                                                                                                                                                                                                                  1], 1),
                                                                                                                                                                                                                                                    ), tr_sc[2]),
                                                                                                                                                                                           Apply((tr_sc_init: list<integer>) => Fold(
                                                                                                                                                                                                                                      (tr_sc: list<integer>, tr_k) => Apply(
                                                                                                                                                                                                                                                                             (tr_sc_next: list<integer>) => tr_sc_next,
                                                                                                                                                                                                                                                                             tr_sc if tr_sc[1] == 1 else Apply(
                                                                                                                                                                                                                                                                                                                (tr_blk: integer) => [1, tr_k, tr_sc[3]] if tr_sc[3] < tr_blk else [0, tr_k, tr_sc[3] - tr_blk],
                                                                                                                                                                                                                                                                                                                Binomial(_tables[(tr_u - 1) *
                                                                                                                                                                                                                                                                                                                                 Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                 (tr_u - 1) +
                                                                                                                                                                                                                                                                                                                                 1] +
                                                                                                                                                                                                                                                                                                                         (tr_k - 1), tr_k) *
                                                                                                                                                                                                                                                                                                                _tables[(tr_u - 1) *
                                                                                                                                                                                                                                                                                                                        Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                        (tr_rem -
                                                                                                                                                                                                                                                                                                                         tr_k * tr_u) +
                                                                                                                                                                                                                                                                                                                        1],
                                                                                                                                                                                                                                                                                                              ),
                                                                                                                                                                                                                                                                           ),
                                                                                                                                                                                                                                      tr_sc_init,
                                                                                                                                                                                                                                      Range(0, (tr_rem -
                                                                                                                                                                                                                                                tr_rem % tr_u) /
                                                                                                                                                                                                                                               tr_u, 1),
                                                                                                                                                                                                                                    ), [0, 0, tr_s[2]]),
                                                                                                                                                                                         ), tr_s[1]),
                                                                                                                                                       ),
                                                                                                                   tr_s_init,
                                                                                                                   Range((_n -
                                                                                                                          _n % 2) /
                                                                                                                         2 if _n % 2 ==
                                                                                                                             1 else (_n -
                                                                                                                                    _n % 2) /
                                                                                                                                   2 -
                                                                                                                                   1, 1, -1),
                                                                                                                 ),
                                                                               [
                                                                                 (_n -
                                                                                  _n % 2) /
                                                                                 2 -
                                                                                 1 if tu_pair else _n - 1,
                                                                                 tu_a +
                                                                                 (_r -
                                                                                  (0 if _n % 2 ==
                                                                                        1 else _tables[((_n -
                                                                                                        _n % 2) /
                                                                                                       2 -
                                                                                                       1) *
                                                                                                      Max(_n, 1) +
                                                                                                      (_n - 1) +
                                                                                                      1]) -
                                                                                  (Binomial(_tables[((_n -
                                                                                                      _n % 2) /
                                                                                                     2 -
                                                                                                     1) *
                                                                                                    Max(_n, 1) +
                                                                                                    ((_n -
                                                                                                      _n % 2) /
                                                                                                     2 -
                                                                                                     1) +
                                                                                                    1] +
                                                                                            1, 2) -
                                                                                   Binomial(_tables[((_n -
                                                                                                      _n % 2) /
                                                                                                     2 -
                                                                                                     1) *
                                                                                                    Max(_n, 1) +
                                                                                                    ((_n -
                                                                                                      _n % 2) /
                                                                                                     2 -
                                                                                                     1) +
                                                                                                    1] -
                                                                                            tu_a +
                                                                                            1, 2))) if tu_pair else _r,
                                                                               ],
                                                                             ), 2),
                                                                 ),
                                                           ),
                                   Apply(
                                          (tg_b_init: list<integer>) => Fold(
                                                                              (tg_b: list<integer>, tg_h) => Apply(
                                                                                                                    (tg_b_next: list<integer>) => tg_b_next,
                                                                                                                    Apply(
                                                                                                                           (tg_mid: integer) => [tg_mid, tg_b[2]] if Binomial(_tables[((_n -
                                                                                                                                                                                        _n % 2) /
                                                                                                                                                                                       2 -
                                                                                                                                                                                       1) *
                                                                                                                                                                                      Max(_n, 1) +
                                                                                                                                                                                      ((_n -
                                                                                                                                                                                        _n % 2) /
                                                                                                                                                                                       2 -
                                                                                                                                                                                       1) +
                                                                                                                                                                                      1] +
                                                                                                                                                                              1, 2) -
                                                                                                                                                                     Binomial(_tables[((_n -
                                                                                                                                                                                        _n % 2) /
                                                                                                                                                                                       2 -
                                                                                                                                                                                       1) *
                                                                                                                                                                                      Max(_n, 1) +
                                                                                                                                                                                      ((_n -
                                                                                                                                                                                        _n % 2) /
                                                                                                                                                                                       2 -
                                                                                                                                                                                       1) +
                                                                                                                                                                                      1] -
                                                                                                                                                                              tg_mid +
                                                                                                                                                                              1, 2) <=
                                                                                                                                                                     _r -
                                                                                                                                                                     (0 if _n % 2 ==
                                                                                                                                                                           1 else _tables[((_n -
                                                                                                                                                                                           _n % 2) /
                                                                                                                                                                                          2 -
                                                                                                                                                                                          1) *
                                                                                                                                                                                         Max(_n, 1) +
                                                                                                                                                                                         (_n - 1) +
                                                                                                                                                                                         1]) else [tg_b[1], tg_mid - 1],
                                                                                                                           (tg_b[1] + tg_b[2] + 1 -
                                                                                                                            (tg_b[1] + tg_b[2] + 1) %
                                                                                                                            2) /
                                                                                                                           2,
                                                                                                                         ) if tg_b[1] < tg_b[2] else tg_b,
                                                                                                                  ),
                                                                              tg_b_init,
                                                                              Range(1, 64, 1),
                                                                            ),
                                          [0, _tables[((_n - _n % 2) / 2 - 1) *
                                                      Max(_n, 1) +
                                                      ((_n - _n % 2) / 2 - 1) +
                                                      1] - 1],
                                        )[1] if tu_pair else 0,
                                 ), !(_n % 2 == 1) && (0 if _n % 2 == 1 else _tables[((_n -
                                                                                      _n % 2) /
                                                                                     2 -
                                                                                     1) *
                                                                                    Max(_n, 1) +
                                                                                    (_n - 1) +
                                                                                    1]) <=
                                                     _r)

rank(_n, _x)

Apply((wk_xs: list<integer>) => Apply(
                                       (wk_w: list<integer>) => Apply(
                                                                       (wk_k: list<integer>) => Apply(
                                                                                                       (tf_pad: list<integer>) => Apply((tf_z_init: list<integer>) => Fold(
                                                                                                                                                                            (tf_z: list<integer>, tf_t) => Apply(
                                                                                                                                                                                                                  (tf_z_next: list<integer>) => tf_z_next,
                                                                                                                                                                                                                  Apply((tf_st: integer) => Apply(
                                                                                                                                                                                                                                                   (tf_w: integer) => Apply((tf_a: integer) => Apply((tf_ps: integer) => Apply((tf_base: integer) => Apply((tf_rem: integer) => Apply((tf_cw: integer) => Apply((tf_cnt: integer) => Apply((tf_ss: integer) => Apply((tf_pw: integer) => Apply((tf_pa: integer) => Apply((tf_bad: integer) => Apply((tf_risk: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_base,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_cw,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_cnt + 1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_ss +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Binomial(tf_a + tf_cnt, tf_cnt + 1),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (1 if tf_w > tf_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tf_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tf_a < tf_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Fold(Function(tf_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Abs(wk_xs[tf_st + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wk_xs[tf_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (wk_xs[tf_ps + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      wk_xs[tf_ps])), tf_ix, tf_iu), 0, Range(0, tf_w - 1, 1)) else 1) if tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               40 <= tf_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tf_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ] if tf_w == tf_cw else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (tf_fin: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_base + tf_fin,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_cw * tf_cnt if 0 < tf_cw else tf_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (1 if tf_w > tf_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tf_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tf_a < tf_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fold(Function(tf_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Abs(wk_xs[tf_st + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        wk_xs[tf_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (wk_xs[tf_ps + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         wk_xs[tf_ps])), tf_ix, tf_iu), 0, Range(0, tf_w - 1, 1)) else 1) if tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  40 <= tf_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fold(Function(tf_acc +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Binomial(_tables[(tf_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (tf_cw - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (tf_kk - 1), tf_kk) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      _tables[(tf_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              (tf_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tf_kk * tf_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1], tf_acc, tf_kk), 0, Range(0, tf_cnt - 1, 1)) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tf_ss *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        _tables[(tf_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (tf_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tf_cnt * tf_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                1] if 0 < tf_cw else 0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ), tf_z[9]), tf_z[8]), tf_z[7]), tf_z[6]), tf_z[5]), tf_z[4]), tf_z[3]), tf_z[2]), tf_z[1]), tf_z[10]), tf_pad[3tf_t]),
                                                                                                                                                                                                                                                   tf_pad[3tf_t - 1],
                                                                                                                                                                                                                                                 ), tf_pad[3tf_t - 2]),
                                                                                                                                                                                                                ),
                                                                                                                                                                            tf_z_init,
                                                                                                                                                                            Range(1, (Length(wk_k) -
                                                                                                                                                                                      Length(wk_k) % 3) /
                                                                                                                                                                                     3 +
                                                                                                                                                                                     1, 1),
                                                                                                                                                                          ), [0, _n - 1, 0, 0, 0, _n + 1, 0, 0, 0, 0]),
                                                                                                       Join(wk_k, [0, 0, 0]),
                                                                                                     )[1] if _n % 2 ==
                                                                                                            1 ||
                                                                                                            Length(wk_k) == 0 ||
                                                                                                            (wk_k[2] if 0 < Length(wk_k) else 0) <
                                                                                                            (_n -
                                                                                                             _n % 2) /
                                                                                                            2 else _tables[((_n -
                                                                                                                            _n % 2) /
                                                                                                                           2 -
                                                                                                                           1) *
                                                                                                                          Max(_n, 1) +
                                                                                                                          (_n - 1) +
                                                                                                                          1] +
                                                                                                                  (Binomial(_tables[((_n -
                                                                                                                                      _n % 2) /
                                                                                                                                     2 -
                                                                                                                                     1) *
                                                                                                                                    Max(_n, 1) +
                                                                                                                                    ((_n -
                                                                                                                                      _n % 2) /
                                                                                                                                     2 -
                                                                                                                                     1) +
                                                                                                                                    1] +
                                                                                                                            1, 2) -
                                                                                                                   Binomial(_tables[((_n -
                                                                                                                                      _n % 2) /
                                                                                                                                     2 -
                                                                                                                                     1) *
                                                                                                                                    Max(_n, 1) +
                                                                                                                                    ((_n -
                                                                                                                                      _n % 2) /
                                                                                                                                     2 -
                                                                                                                                     1) +
                                                                                                                                    1] -
                                                                                                                            (wk_k[3] if 1 < Length(wk_k) else 0) +
                                                                                                                            1, 2)) +
                                                                                                                  (Apply((tt_pad: list<integer>) => Apply(
                                                                                                                                                           (tt_z_init: list<integer>) => Fold(
                                                                                                                                                                                               (tt_z: list<integer>, tt_t) => Apply(
                                                                                                                                                                                                                                     (tt_z_next: list<integer>) => tt_z_next,
                                                                                                                                                                                                                                     Apply((tt_st: integer) => Apply(
                                                                                                                                                                                                                                                                      (tt_w: integer) => Apply((tt_a: integer) => Apply((tt_ps: integer) => Apply((tt_base: integer) => Apply((tt_rem: integer) => Apply((tt_cw: integer) => Apply((tt_cnt: integer) => Apply((tt_ss: integer) => Apply((tt_pw: integer) => Apply((tt_pa: integer) => Apply((tt_bad: integer) => Apply((tt_risk: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_base,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_cw,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_cnt + 1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_ss +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Binomial(tt_a + tt_cnt, tt_cnt + 1),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (1 if tt_w > tt_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tt_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tt_a < tt_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fold(Function(tt_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Abs(wk_xs[tt_st + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        wk_xs[tt_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (wk_xs[tt_ps + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         wk_xs[tt_ps])), tt_ix, tt_iu), 0, Range(0, tt_w - 1, 1)) else 1) if tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  40 <= tt_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ] if tt_w == tt_cw else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           (tt_fin: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_base + tt_fin,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_cw * tt_cnt if 0 < tt_cw else tt_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (1 if tt_w > tt_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tt_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tt_a < tt_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Fold(Function(tt_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Abs(wk_xs[tt_st + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           wk_xs[tt_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           (wk_xs[tt_ps + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            wk_xs[tt_ps])), tt_ix, tt_iu), 0, Range(0, tt_w - 1, 1)) else 1) if tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     40 <= tt_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Fold(Function(tt_acc +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Binomial(_tables[(tt_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (tt_cw - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (tt_kk - 1), tt_kk) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         _tables[(tt_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 (tt_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_kk * tt_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1], tt_acc, tt_kk), 0, Range(0, tt_cnt - 1, 1)) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tt_ss *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           _tables[(tt_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   (tt_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tt_cnt * tt_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1] if 0 < tt_cw else 0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ), tt_z[9]), tt_z[8]), tt_z[7]), tt_z[6]), tt_z[5]), tt_z[4]), tt_z[3]), tt_z[2]), tt_z[1]), tt_z[10]), tt_pad[3tt_t]),
                                                                                                                                                                                                                                                                      tt_pad[3tt_t - 1],
                                                                                                                                                                                                                                                                    ), tt_pad[3tt_t - 2]),
                                                                                                                                                                                                                                   ),
                                                                                                                                                                                               tt_z_init,
                                                                                                                                                                                               Range(1, (Length(Drop(wk_k, 3)) -
                                                                                                                                                                                                         Length(Drop(wk_k, 3)) %
                                                                                                                                                                                                         3) /
                                                                                                                                                                                                        3 +
                                                                                                                                                                                                        1, 1),
                                                                                                                                                                                             ),
                                                                                                                                                           [0, (_n -
                                                                                                                                                                _n % 2) /
                                                                                                                                                               2 -
                                                                                                                                                               1, 0, 0, 0, _n + 1, 0, 0, 0, 0],
                                                                                                                                                         ), Join(Drop(wk_k, 3), [0, 0, 0]))[1] -
                                                                                                                   (wk_k[3] if 1 < Length(wk_k) else 0)),
                                                                       Apply(
                                                                              (wk_h: list<integer>) => Drop(wk_h, 1),
                                                                              Apply(
                                                                                     (wk_acc_init: list<integer>) => Fold(
                                                                                                                           (wk_acc: list<integer>, wk_t) => Apply(
                                                                                                                                                                   (wk_acc_next: list<integer>) => wk_acc_next,
                                                                                                                                                                   Apply((wk_q: list<integer>) => Apply((wk_j: integer) => Join([wk_j +
                                                                                                                                                                                                                                 wk_w[wk_j + 2]], Drop(wk_q, 1), [wk_j, wk_w[wk_j + 2], wk_w[_n + wk_j + 2]]) if wk_j <= _n &&
                                                                                                                                                                                                                                                                                                   wk_xs[wk_j] ==
                                                                                                                                                                                                                                                                                                   wk_xs[1] + 1 else wk_q, wk_acc[1]), wk_acc),
                                                                                                                                                                 ),
                                                                                                                           wk_acc_init,
                                                                                                                           Range(1, _n - 1, 1),
                                                                                                                         ),
                                                                                     [1 + 1],
                                                                                   ),
                                                                            ),
                                                                     ),
                                       Apply(
                                              (wk_p_init: list<integer>) => Fold((wk_p: list<integer>, wk_i) => Apply(
                                                                                                                       (wk_p_next: list<integer>) => wk_p_next,
                                                                                                                       Apply(
                                                                                                                              (wk_hop: list<integer>) => Apply((wk_size: integer) => Apply(
                                                                                                                                                                                            (wk_z: list<integer>) => ReplaceAt(
                                                                                                                                                                                                                                ReplaceAt(ReplaceAt(ReplaceAt(wk_p, 1, wk_p[1] + wk_z[8]), 2, wk_p[2] + wk_z[9]), wk_i + 2, wk_size),
                                                                                                                                                                                                                                _n + wk_i + 2,
                                                                                                                                                                                                                                wk_z[1],
                                                                                                                                                                                                                              ),
                                                                                                                                                                                            Apply(
                                                                                                                                                                                                   (tw_pad: list<integer>) => Apply((tw_z_init: list<integer>) => Fold(
                                                                                                                                                                                                                                                                        (tw_z: list<integer>, tw_t) => Apply(
                                                                                                                                                                                                                                                                                                              (tw_z_next: list<integer>) => tw_z_next,
                                                                                                                                                                                                                                                                                                              Apply((tw_st: integer) => Apply(
                                                                                                                                                                                                                                                                                                                                               (tw_w: integer) => Apply((tw_a: integer) => Apply((tw_ps: integer) => Apply((tw_base: integer) => Apply((tw_rem: integer) => Apply((tw_cw: integer) => Apply((tw_cnt: integer) => Apply((tw_ss: integer) => Apply((tw_pw: integer) => Apply((tw_pa: integer) => Apply((tw_bad: integer) => Apply((tw_risk: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_base,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_cw,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_cnt + 1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_ss +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Binomial(tw_a + tw_cnt, tw_cnt + 1),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (1 if tw_w > tw_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              tw_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              tw_a < tw_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Fold(Function(tw_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Abs(wk_xs[tw_st + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 wk_xs[tw_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 (wk_xs[tw_ps + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  wk_xs[tw_ps])), tw_ix, tw_iu), 0, Range(0, tw_w - 1, 1)) else 1) if tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           40 <= tw_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tw_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ] if tw_w == tw_cw else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (tw_fin: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_base + tw_fin,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_cw * tw_cnt if 0 < tw_cw else tw_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           (1 if tw_w > tw_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tw_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tw_a < tw_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Fold(Function(tw_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Abs(wk_xs[tw_st + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    wk_xs[tw_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (wk_xs[tw_ps + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wk_xs[tw_ps])), tw_ix, tw_iu), 0, Range(0, tw_w - 1, 1)) else 1) if tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              40 <= tw_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Fold(Function(tw_acc +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Binomial(_tables[(tw_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   (tw_cw - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           (tw_kk - 1), tw_kk) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  _tables[(tw_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          (tw_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           tw_kk * tw_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          1], tw_acc, tw_kk), 0, Range(0, tw_cnt - 1, 1)) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tw_ss *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    _tables[(tw_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (tw_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             tw_cnt * tw_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1] if 0 < tw_cw else 0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ), tw_z[9]), tw_z[8]), tw_z[7]), tw_z[6]), tw_z[5]), tw_z[4]), tw_z[3]), tw_z[2]), tw_z[1]), tw_z[10]), tw_pad[3tw_t]),
                                                                                                                                                                                                                                                                                                                                               tw_pad[3tw_t - 1],
                                                                                                                                                                                                                                                                                                                                             ), tw_pad[3tw_t - 2]),
                                                                                                                                                                                                                                                                                                            ),
                                                                                                                                                                                                                                                                        tw_z_init,
                                                                                                                                                                                                                                                                        Range(1, (Length(Drop(wk_hop, 1)) -
                                                                                                                                                                                                                                                                                  Length(Drop(wk_hop, 1)) %
                                                                                                                                                                                                                                                                                  3) /
                                                                                                                                                                                                                                                                                 3 +
                                                                                                                                                                                                                                                                                 1, 1),
                                                                                                                                                                                                                                                                      ), [0, wk_size - 1, 0, 0, 0, _n + 1, 0, 0, 0, 0]),
                                                                                                                                                                                                   Join(Drop(wk_hop, 1), [0, 0, 0]),
                                                                                                                                                                                                 ),
                                                                                                                                                                                          ), wk_hop[1] - wk_i),
                                                                                                                              Apply((wk_acc_init: list<integer>) => Fold(
                                                                                                                                                                          (wk_acc: list<integer>, wk_t) => Apply(
                                                                                                                                                                                                                  (wk_acc_next: list<integer>) => wk_acc_next,
                                                                                                                                                                                                                  Apply((wk_q: list<integer>) => Apply((wk_j: integer) => Join([wk_j +
                                                                                                                                                                                                                                                                                wk_p[wk_j + 2]], Drop(wk_q, 1), [wk_j, wk_p[wk_j + 2], wk_p[_n + wk_j + 2]]) if wk_j <= _n &&
                                                                                                                                                                                                                                                                                                                                                  wk_xs[wk_j] ==
                                                                                                                                                                                                                                                                                                                                                  wk_xs[wk_i] + 1 else wk_q, wk_acc[1]), wk_acc),
                                                                                                                                                                                                                ),
                                                                                                                                                                          wk_acc_init,
                                                                                                                                                                          Range(1, _n - wk_i, 1),
                                                                                                                                                                        ), [wk_i + 1]),
                                                                                                                            ),
                                                                                                                     ), wk_p_init, Range(_n, 2, -1)),
                                              Join(
                                                    [0, 0],
                                                    Map(
                                                         Function(1, wk_z),
                                                         Range(1, _n, 1),
                                                       ),
                                                    Map(
                                                         Function(0, wk_z),
                                                         Range(1, _n, 1),
                                                       ),
                                                  ),
                                            ),
                                     ), Join(_x, [-1]))

valid(_n, _x)

(Apply((wk_xs: list<integer>) => Apply(
                                        (wk_w: list<integer>) => Apply(
                                                                        (wk_k: list<integer>) => Apply(
                                                                                                        (wk_z: list<integer>) => False if 0 <
                                                                                                                                          wk_w[1] +
                                                                                                                                          wk_z[8] +
                                                                                                                                          (1 if 1 < _n &&
                                                                                                                                                (_n -
                                                                                                                                                 _n % 2) /
                                                                                                                                                2 <
                                                                                                                                                (wk_k[2] if 0 < Length(wk_k) else 0) else 0) +
                                                                                                                                          (1 if !(_n % 2 ==
                                                                                                                                                  1) &&
                                                                                                                                                (wk_k[2] if 0 < Length(wk_k) else 0) ==
                                                                                                                                                (_n -
                                                                                                                                                 _n % 2) /
                                                                                                                                                2 &&
                                                                                                                                                (_n -
                                                                                                                                                 _n % 2) /
                                                                                                                                                2 <
                                                                                                                                                40 &&
                                                                                                                                                Apply(
                                                                                                                                                       (tt_pad: list<integer>) => Apply((tt_z_init: list<integer>) => Fold(
                                                                                                                                                                                                                            (tt_z: list<integer>, tt_t) => Apply(
                                                                                                                                                                                                                                                                  (tt_z_next: list<integer>) => tt_z_next,
                                                                                                                                                                                                                                                                  Apply((tt_st: integer) => Apply(
                                                                                                                                                                                                                                                                                                   (tt_w: integer) => Apply((tt_a: integer) => Apply((tt_ps: integer) => Apply((tt_base: integer) => Apply((tt_rem: integer) => Apply((tt_cw: integer) => Apply((tt_cnt: integer) => Apply((tt_ss: integer) => Apply((tt_pw: integer) => Apply((tt_pa: integer) => Apply((tt_bad: integer) => Apply((tt_risk: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_base,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_cw,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_cnt + 1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_ss +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Binomial(tt_a + tt_cnt, tt_cnt + 1),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (1 if tt_w > tt_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tt_a < tt_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Fold(Function(tt_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Abs(wk_xs[tt_st + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wk_xs[tt_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (wk_xs[tt_ps + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      wk_xs[tt_ps])), tt_ix, tt_iu), 0, Range(0, tt_w - 1, 1)) else 1) if tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               40 <= tt_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tt_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ] if tt_w == tt_cw else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (tt_fin: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_base + tt_fin,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_cw * tt_cnt if 0 < tt_cw else tt_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (1 if tt_w > tt_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tt_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tt_a < tt_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Fold(Function(tt_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Abs(wk_xs[tt_st + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        wk_xs[tt_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (wk_xs[tt_ps + tt_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         wk_xs[tt_ps])), tt_ix, tt_iu), 0, Range(0, tt_w - 1, 1)) else 1) if tt_w == tt_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  40 <= tt_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Fold(Function(tt_acc +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Binomial(_tables[(tt_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (tt_cw - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (tt_kk - 1), tt_kk) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      _tables[(tt_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              (tt_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tt_kk * tt_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              1], tt_acc, tt_kk), 0, Range(0, tt_cnt - 1, 1)) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        tt_ss *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        _tables[(tt_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (tt_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 tt_cnt * tt_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                1] if 0 < tt_cw else 0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ), tt_z[9]), tt_z[8]), tt_z[7]), tt_z[6]), tt_z[5]), tt_z[4]), tt_z[3]), tt_z[2]), tt_z[1]), tt_z[10]), tt_pad[3tt_t]),
                                                                                                                                                                                                                                                                                                   tt_pad[3tt_t - 1],
                                                                                                                                                                                                                                                                                                 ), tt_pad[3tt_t - 2]),
                                                                                                                                                                                                                                                                ),
                                                                                                                                                                                                                            tt_z_init,
                                                                                                                                                                                                                            Range(1, (Length(Drop(wk_k, 3)) -
                                                                                                                                                                                                                                      Length(Drop(wk_k, 3)) %
                                                                                                                                                                                                                                      3) /
                                                                                                                                                                                                                                     3 +
                                                                                                                                                                                                                                     1, 1),
                                                                                                                                                                                                                          ), [0, (_n -
                                                                                                                                                                                                                                 _n % 2) /
                                                                                                                                                                                                                                2 -
                                                                                                                                                                                                                                1, 0, 0, 0, _n + 1, 0, 0, 0, 0]),
                                                                                                                                                       Join(Drop(wk_k, 3), [0, 0, 0]),
                                                                                                                                                     )[1] <
                                                                                                                                                (wk_k[3] if 1 < Length(wk_k) else 0) else 0) else 0 if 0 <
                                                                                                                                                     wk_w[2] +
                                                                                                                                                     wk_z[9] +
                                                                                                                                                     (1 if !(_n % 2 ==
                                                                                                                                                             1) &&
                                                                                                                                                           (wk_k[2] if 0 < Length(wk_k) else 0) ==
                                                                                                                                                           (_n -
                                                                                                                                                            _n % 2) /
                                                                                                                                                           2 &&
                                                                                                                                                           40 <=
                                                                                                                                                           (_n -
                                                                                                                                                            _n % 2) /
                                                                                                                                                           2 &&
                                                                                                                                                           !(0 ==
                                                                                                                                                             Fold(
                                                                                                                                                                   Function(wk_d +
                                                                                                                                                                            Abs(_x[2 + wk_u] -
                                                                                                                                                                                1 -
                                                                                                                                                                                _x[(_n -
                                                                                                                                                                                    _n % 2) /
                                                                                                                                                                                   2 + 1 + wk_u]), wk_d, wk_u),
                                                                                                                                                                   0,
                                                                                                                                                                   Range(1, (_n -
                                                                                                                                                                             _n % 2) /
                                                                                                                                                                            2 -
                                                                                                                                                                            1, 1),
                                                                                                                                                                 )) else 0) else True,
                                                                                                        Apply(
                                                                                                               (tf_pad: list<integer>) => Apply((tf_z_init: list<integer>) => Fold(
                                                                                                                                                                                    (tf_z: list<integer>, tf_t) => Apply(
                                                                                                                                                                                                                          (tf_z_next: list<integer>) => tf_z_next,
                                                                                                                                                                                                                          Apply((tf_st: integer) => Apply(
                                                                                                                                                                                                                                                           (tf_w: integer) => Apply((tf_a: integer) => Apply((tf_ps: integer) => Apply((tf_base: integer) => Apply((tf_rem: integer) => Apply((tf_cw: integer) => Apply((tf_cnt: integer) => Apply((tf_ss: integer) => Apply((tf_pw: integer) => Apply((tf_pa: integer) => Apply((tf_bad: integer) => Apply((tf_risk: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_base,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_cw,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_cnt + 1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_ss +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Binomial(tf_a + tf_cnt, tf_cnt + 1),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (1 if tf_w > tf_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          tf_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          tf_a < tf_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Fold(Function(tf_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Abs(wk_xs[tf_st + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             wk_xs[tf_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             (wk_xs[tf_ps + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              wk_xs[tf_ps])), tf_ix, tf_iu), 0, Range(0, tf_w - 1, 1)) else 1) if tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       40 <= tf_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    tf_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ] if tf_w == tf_cw else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (tf_fin: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_base + tf_fin,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_cw * tf_cnt if 0 < tf_cw else tf_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (1 if tf_w > tf_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             tf_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             tf_a < tf_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Fold(Function(tf_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            Abs(wk_xs[tf_st + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                wk_xs[tf_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                (wk_xs[tf_ps + tf_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 wk_xs[tf_ps])), tf_ix, tf_iu), 0, Range(0, tf_w - 1, 1)) else 1) if tf_w == tf_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          40 <= tf_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold(Function(tf_acc +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Binomial(_tables[(tf_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               (tf_cw - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       (tf_kk - 1), tf_kk) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              _tables[(tf_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      (tf_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       tf_kk * tf_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      1], tf_acc, tf_kk), 0, Range(0, tf_cnt - 1, 1)) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                tf_ss *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                _tables[(tf_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        (tf_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tf_cnt * tf_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        1] if 0 < tf_cw else 0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ), tf_z[9]), tf_z[8]), tf_z[7]), tf_z[6]), tf_z[5]), tf_z[4]), tf_z[3]), tf_z[2]), tf_z[1]), tf_z[10]), tf_pad[3tf_t]),
                                                                                                                                                                                                                                                           tf_pad[3tf_t - 1],
                                                                                                                                                                                                                                                         ), tf_pad[3tf_t - 2]),
                                                                                                                                                                                                                        ),
                                                                                                                                                                                    tf_z_init,
                                                                                                                                                                                    Range(1, (Length(wk_k) -
                                                                                                                                                                                              Length(wk_k) % 3) /
                                                                                                                                                                                             3 +
                                                                                                                                                                                             1, 1),
                                                                                                                                                                                  ), [0, _n - 1, 0, 0, 0, _n + 1, 0, 0, 0, 0]),
                                                                                                               Join(wk_k, [0, 0, 0]),
                                                                                                             ),
                                                                                                      ),
                                                                        Apply(
                                                                               (wk_h: list<integer>) => Drop(wk_h, 1),
                                                                               Apply(
                                                                                      (wk_acc_init: list<integer>) => Fold(
                                                                                                                            (wk_acc: list<integer>, wk_t) => Apply(
                                                                                                                                                                    (wk_acc_next: list<integer>) => wk_acc_next,
                                                                                                                                                                    Apply((wk_q: list<integer>) => Apply((wk_j: integer) => Join([wk_j +
                                                                                                                                                                                                                                  wk_w[wk_j + 2]], Drop(wk_q, 1), [wk_j, wk_w[wk_j + 2], wk_w[_n + wk_j + 2]]) if wk_j <= _n &&
                                                                                                                                                                                                                                                                                                    wk_xs[wk_j] ==
                                                                                                                                                                                                                                                                                                    wk_xs[1] + 1 else wk_q, wk_acc[1]), wk_acc),
                                                                                                                                                                  ),
                                                                                                                            wk_acc_init,
                                                                                                                            Range(1, _n - 1, 1),
                                                                                                                          ),
                                                                                      [1 + 1],
                                                                                    ),
                                                                             ),
                                                                      ),
                                        Apply(
                                               (wk_p_init: list<integer>) => Fold((wk_p: list<integer>, wk_i) => Apply(
                                                                                                                        (wk_p_next: list<integer>) => wk_p_next,
                                                                                                                        Apply(
                                                                                                                               (wk_hop: list<integer>) => Apply((wk_size: integer) => Apply(
                                                                                                                                                                                             (wk_z: list<integer>) => ReplaceAt(
                                                                                                                                                                                                                                 ReplaceAt(ReplaceAt(ReplaceAt(wk_p, 1, wk_p[1] + wk_z[8]), 2, wk_p[2] + wk_z[9]), wk_i + 2, wk_size),
                                                                                                                                                                                                                                 _n + wk_i + 2,
                                                                                                                                                                                                                                 wk_z[1],
                                                                                                                                                                                                                               ),
                                                                                                                                                                                             Apply(
                                                                                                                                                                                                    (tw_pad: list<integer>) => Apply((tw_z_init: list<integer>) => Fold(
                                                                                                                                                                                                                                                                         (tw_z: list<integer>, tw_t) => Apply(
                                                                                                                                                                                                                                                                                                               (tw_z_next: list<integer>) => tw_z_next,
                                                                                                                                                                                                                                                                                                               Apply((tw_st: integer) => Apply(
                                                                                                                                                                                                                                                                                                                                                (tw_w: integer) => Apply((tw_a: integer) => Apply((tw_ps: integer) => Apply((tw_base: integer) => Apply((tw_rem: integer) => Apply((tw_cw: integer) => Apply((tw_cnt: integer) => Apply((tw_ss: integer) => Apply((tw_pw: integer) => Apply((tw_pa: integer) => Apply((tw_bad: integer) => Apply((tw_risk: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_base,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_cw,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_cnt + 1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_ss +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         Binomial(tw_a + tw_cnt, tw_cnt + 1),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         (1 if tw_w > tw_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tw_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               tw_a < tw_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Fold(Function(tw_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Abs(wk_xs[tw_st + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  wk_xs[tw_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  (wk_xs[tw_ps + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   wk_xs[tw_ps])), tw_ix, tw_iu), 0, Range(0, tw_w - 1, 1)) else 1) if tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            40 <= tw_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         tw_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ] if tw_w == tw_cw else Apply(
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (tw_fin: integer) => [
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_base + tw_fin,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_cw * tw_cnt if 0 < tw_cw else tw_rem,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            1,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_w,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_a,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_bad +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (1 if tw_w > tw_pw ||
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tw_w < 40 &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  tw_a < tw_pa else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_risk +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ((0 if 0 ==
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Fold(Function(tw_ix +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 Abs(wk_xs[tw_st + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     wk_xs[tw_st] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     (wk_xs[tw_ps + tw_iu] -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      wk_xs[tw_ps])), tw_ix, tw_iu), 0, Range(0, tw_w - 1, 1)) else 1) if tw_w == tw_pw &&
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               40 <= tw_w else 0),
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_st,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ],
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Fold(Function(tw_acc +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   Binomial(_tables[(tw_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    (tw_cw - 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    1] +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            (tw_kk - 1), tw_kk) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   _tables[(tw_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           (tw_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            tw_kk * tw_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           1], tw_acc, tw_kk), 0, Range(0, tw_cnt - 1, 1)) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     tw_ss *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     _tables[(tw_cw - 1) *
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Max(_n, 1) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             (tw_rem -
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              tw_cnt * tw_cw) +
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             1] if 0 < tw_cw else 0,
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ), tw_z[9]), tw_z[8]), tw_z[7]), tw_z[6]), tw_z[5]), tw_z[4]), tw_z[3]), tw_z[2]), tw_z[1]), tw_z[10]), tw_pad[3tw_t]),
                                                                                                                                                                                                                                                                                                                                                tw_pad[3tw_t - 1],
                                                                                                                                                                                                                                                                                                                                              ), tw_pad[3tw_t - 2]),
                                                                                                                                                                                                                                                                                                             ),
                                                                                                                                                                                                                                                                         tw_z_init,
                                                                                                                                                                                                                                                                         Range(1, (Length(Drop(wk_hop, 1)) -
                                                                                                                                                                                                                                                                                   Length(Drop(wk_hop, 1)) %
                                                                                                                                                                                                                                                                                   3) /
                                                                                                                                                                                                                                                                                  3 +
                                                                                                                                                                                                                                                                                  1, 1),
                                                                                                                                                                                                                                                                       ), [0, wk_size - 1, 0, 0, 0, _n + 1, 0, 0, 0, 0]),
                                                                                                                                                                                                    Join(Drop(wk_hop, 1), [0, 0, 0]),
                                                                                                                                                                                                  ),
                                                                                                                                                                                           ), wk_hop[1] - wk_i),
                                                                                                                               Apply((wk_acc_init: list<integer>) => Fold(
                                                                                                                                                                           (wk_acc: list<integer>, wk_t) => Apply(
                                                                                                                                                                                                                   (wk_acc_next: list<integer>) => wk_acc_next,
                                                                                                                                                                                                                   Apply((wk_q: list<integer>) => Apply((wk_j: integer) => Join([wk_j +
                                                                                                                                                                                                                                                                                 wk_p[wk_j + 2]], Drop(wk_q, 1), [wk_j, wk_p[wk_j + 2], wk_p[_n + wk_j + 2]]) if wk_j <= _n &&
                                                                                                                                                                                                                                                                                                                                                   wk_xs[wk_j] ==
                                                                                                                                                                                                                                                                                                                                                   wk_xs[wk_i] + 1 else wk_q, wk_acc[1]), wk_acc),
                                                                                                                                                                                                                 ),
                                                                                                                                                                           wk_acc_init,
                                                                                                                                                                           Range(1, _n - wk_i, 1),
                                                                                                                                                                         ), [wk_i + 1]),
                                                                                                                             ),
                                                                                                                      ), wk_p_init, Range(_n, 2, -1)),
                                               Join(
                                                     [0, 0],
                                                     Map(
                                                          Function(1, wk_z),
                                                          Range(1, _n, 1),
                                                        ),
                                                     Map(
                                                          Function(0, wk_z),
                                                          Range(1, _n, 1),
                                                        ),
                                                   ),
                                             ),
                                      ), Join(_x, [-1])) if _x[1] == 0 && Fold(
                                                                               Function(ok_wk_v &&
                                                                                        1 <= _x[wk_v] &&
                                                                                        _x[wk_v] <=
                                                                                        _x[wk_v - 1] +
                                                                                        1, ok_wk_v, wk_v),
                                                                               True,
                                                                               Range(2, _n, 1),
                                                                             ) else False) if 1 <= _n &&
                                                                                             Length(_x) == _n else False

tables(_n)

Fold(Function(Join(
                    tr_t,
                    Fold(Function(ReplaceAt(
                                             tr_row,
                                             tr_c + 1,
                                             Apply((tr_a_init: integer) => Fold(
                                                                                 (tr_a: integer, tr_k) => Apply(
                                                                                                                 (tr_a_next: integer) => tr_a_next,
                                                                                                                 tr_a +
                                                                                                                 Binomial(tr_t[(tr_s - 1) *
                                                                                                                               Max(_n, 1) +
                                                                                                                               (tr_s - 1) +
                                                                                                                               1] +
                                                                                                                          (tr_k - 1), tr_k) *
                                                                                                                 tr_t[(tr_s - 1) *
                                                                                                                      Max(_n, 1) +
                                                                                                                      (tr_c -
                                                                                                                       tr_k * tr_s) +
                                                                                                                      1],
                                                                                                               ),
                                                                                 tr_a_init,
                                                                                 Range(0, (tr_c -
                                                                                           tr_c % tr_s) /
                                                                                          tr_s, 1),
                                                                               ), 0),
                                           ), tr_row, tr_c), Map(
                                                                 Function(
                                                                           0,
                                                                           tr_z,
                                                                         ),
                                                                 Range(
                                                                        0,
                                                                        Max(
                                                                             _n,
                                                                             1,
                                                                           ) - 1,
                                                                        1,
                                                                      ),
                                                               ), Range(
                                                                        0,
                                                                        Max(
                                                                             _n,
                                                                             1,
                                                                           ) - 1,
                                                                        1,
                                                                      )),
                  ), tr_t, tr_s), Fold(
                                       Function(ReplaceAt(
                                                           tr_row,
                                                           tr_c + 1,
                                                           1 if tr_c == 0 else 0,
                                                         ), tr_row, tr_c),
                                       Map(
                                            Function(0, tr_z),
                                            Range(0, Max(_n, 1) - 1, 1),
                                          ),
                                       Range(0, Max(_n, 1) - 1, 1),
                                     ), Range(1, Max(_n, 1) - 1, 1))

Enumeration

Examples

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

Count(UnlabeledFreeTrees(7))=11Count(UnlabeledFreeTrees(7)) = 11, A000055

live ↗
InCount(UnlabeledFreeTrees(7))\mathrm{Count}(\mathrm{UnlabeledFreeTrees}(7))Out1111
About
Examples2
CrosswalkOEIS

See also: RootedUnlabeledTrees, Binomial, Count, At