Skip to content

DoubleFactorialNumbers ​

The odd double factorials 1,3,15,105,…1, 3, 15, 105, … — (2n−1)!!(2n-1)!! — perfect matchings of K2nK_{2n}.

DoubleFactorialNumbers(2n−1)!!(2n-1)!! for n=1,2,3,…n = 1, 2, 3, ….

Domain: Collections

Details
  • A lazy indexed collection: Count(DoubleFactorialNumbers)=+∞Count(DoubleFactorialNumbers) = +\infty, and At(DoubleFactorialNumbers,k)=(2k−1)!!At(DoubleFactorialNumbers, k) = (2k-1)!!, computed exactly over arbitrary-precision integers -- At(DoubleFactorialNumbers,5)=945At(DoubleFactorialNumbers, 5) = 945.
  • OEIS A001147, whose offset differs from ours the same way as FactorialNumbers: A001147 opens with the duplicate a(0)=a(1)=1a(0) = a(1) = 1; this collection starts at n=1n=1 without repeating it.
  • Membership goes through Element by growing the sequence forward until it reaches or passes the candidate -- Element(945,DoubleFactorialNumbers)Element(945, DoubleFactorialNumbers) is true, Element(900,DoubleFactorialNumbers)Element(900, DoubleFactorialNumbers) is false.

Definition

Epsil, as the implementation runs it.

count()

PositiveInfinity

unrank(_r)

Fold(Function([wk_w[1] * (2wk_n + 3)], wk_w, wk_n), [1], Range(0, _r - 1, 1))[1]

rank(_x)

Fold(
      Function(
                wk_w if wk_n >= 0 && wk_w[1] > _x else [
                                                         wk_w[1] * (2wk_n + 3),
                                                         wk_n if wk_w[2] < 0 &&
                                                                 wk_w[1] == _x else wk_w[2],
                                                       ],
                wk_w,
                wk_n,
              ),
      [1, -1],
      Range(
             0,
             1 * (Apply(
                         (fl_r: list<integer>) => fl_r[2],
                         Fold(Function(
                                        [
                                          (fl_s[1] - fl_s[1] % 2 ^ fl_k) / 2 ^
                                                                           fl_k,
                                          fl_s[2] + fl_k,
                                        ] if fl_s[1] >= 2 ^ fl_k else fl_s,
                                        fl_s,
                                        fl_k,
                                      ), [_x + 2, 0], [
                                                       8_192,
                                                       4_096,
                                                       2_048,
                                                       1_024,
                                                       512,
                                                       256,
                                                       128,
                                                       64,
                                                       32,
                                                       16,
                                                       8,
                                                       4,
                                                       2,
                                                       1,
                                                     ]),
                       ) + 1) + 12,
             1,
           ),
    )[2] if _x >= 0 else -1

valid(_x)

Fold(
      Function(
                wk_w if wk_n >= 0 && wk_w[1] > _x else [
                                                         wk_w[1] * (2wk_n + 3),
                                                         wk_n if wk_w[2] < 0 &&
                                                                 wk_w[1] == _x else wk_w[2],
                                                       ],
                wk_w,
                wk_n,
              ),
      [1, -1],
      Range(
             0,
             1 * (Apply(
                         (fl_r: list<integer>) => fl_r[2],
                         Fold(Function(
                                        [
                                          (fl_s[1] - fl_s[1] % 2 ^ fl_k) / 2 ^
                                                                           fl_k,
                                          fl_s[2] + fl_k,
                                        ] if fl_s[1] >= 2 ^ fl_k else fl_s,
                                        fl_s,
                                        fl_k,
                                      ), [_x + 2, 0], [
                                                       8_192,
                                                       4_096,
                                                       2_048,
                                                       1_024,
                                                       512,
                                                       256,
                                                       128,
                                                       64,
                                                       32,
                                                       16,
                                                       8,
                                                       4,
                                                       2,
                                                       1,
                                                     ]),
                       ) + 1) + 12,
             1,
           ),
    )[2] >= 0 if _x >= 0 else False

Enumeration

Examples

1 more kept as data, checked against the oracles
About
Examples1
CrosswalkOEISWolfram Languagemathlib4

See also: FactorialNumbers, PhylogeneticTrees, Count, At, Element