Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Multifactorial/D/multifactorial.d
Normal file
12
Task/Multifactorial/D/multifactorial.d
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import std.stdio, std.algorithm, std.range;
|
||||
|
||||
T multifactorial(T=long)(in int n, in int m) pure /*nothrow*/ {
|
||||
T one = 1;
|
||||
return reduce!q{a * b}(one, iota(n, 0, -m));
|
||||
}
|
||||
|
||||
void main() {
|
||||
foreach (immutable m; 1 .. 11)
|
||||
writefln("%2d: %s", m, iota(1, 11)
|
||||
.map!(n => multifactorial(n, m)));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue