user
The factorial of a number, written as 

n
!
{\displaystyle {\displaystyle n!}}
, is defined as 

n
!
=
n
(
n
−
1
)
(
n
−
2
)
.
.
.
(
2
)
(
1
)
{\displaystyle {\displaystyle n!=n(n-1)(n-2)...(2)(1)}}
.

Multifactorials generalize factorials as follows:

:   n
    !
    =
    n
    (
    n
    −
    1
    )
    (
    n
    −
    2
    )
    .
    .
    .
    (
    2
    )
    (
    1
    )
    {\displaystyle {\displaystyle n!=n(n-1)(n-2)...(2)(1)}}
:   n
    !
    !
    =
    n
    (
    n
    −
    2
    )
    (
    n
    −
    4
    )
    .
    .
    .
    {\displaystyle {\displaystyle n!!=n(n-2)(n-4)...}}
:   n
    !
    !
    !
    =
    n
    (
    n
    −
    3
    )
    (
    n
    −
    6
    )
    .
    .
    .
    {\displaystyle {\displaystyle n!!!=n(n-3)(n-6)...}}
:   n
    !
    !
    !
    !
    =
    n
    (
    n
    −
    4
    )
    (
    n
    −
    8
    )
    .
    .
    .
    {\displaystyle {\displaystyle n!!!!=n(n-4)(n-8)...}}
:   n
    !
    !
    !
    !
    !
    =
    n
    (
    n
    −
    5
    )
    (
    n
    −
    10
    )
    .
    .
    .
    {\displaystyle {\displaystyle n!!!!!=n(n-5)(n-10)...}}

In all cases, the terms in the products are positive integers.

If we define the degree of the multifactorial as the difference in successive terms that are multiplied together for a multifactorial (the number of exclamation marks), then the task is twofold:

1. Write a function that given n and the degree, calculates the multifactorial.
2. Use the function to generate and display here a table of the first ten members (1 to 10) of the first five degrees of multifactorial.

**Note:** The wikipedia entry on multifactorials gives a different formula. This task uses the Wolfram mathworld definition.
assistant
(formerly Perl 6)

```
for 1 .. 5 -> $degree {
    sub mfact($n) { [*] $n, *-$degree ...^ * <= 0 };
    say "$degree: ", map &mfact, 1..10
}

```

Output:

```
1: 1 2 6 24 120 720 5040 40320 362880 3628800
2: 1 2 3 8 15 48 105 384 945 3840
3: 1 2 3 4 10 18 28 80 162 280
4: 1 2 3 4 5 12 21 32 45 120
5: 1 2 3 4 5 6 14 24 36 50
```