doubleFactorial

Computes the double factorial of n: n * (n - 2) * (n - 4) * ... * 1

ulong
doubleFactorial
(
ulong n
)

Examples

import std.array: array;
auto dfacs = iota(1, 21).map!(n => doubleFactorial(n)).array;
assert(dfacs == [1, 2, 3, 8, 15, 48, 105, 384, 945, 3840, 
                10395, 46080, 135135, 645120, 2027025, 
                10321920, 34459425, 185794560, 654729075, 
                3715891200]);

Meta