langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
21
Task/Multifactorial/Objeck/multifactorial.objeck
Normal file
21
Task/Multifactorial/Objeck/multifactorial.objeck
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class Multifact {
|
||||
function : MultiFact(n : Int, deg : Int) ~ Int {
|
||||
result := n;
|
||||
while (n >= deg + 1){
|
||||
result *= (n - deg);
|
||||
n -= deg;
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function : Main(args : String[]) ~ Nil {
|
||||
for (i := 1; i <= 5; i+=1;){
|
||||
IO.Console->Print("Degree ")->Print(i)->Print(": ");
|
||||
for (j := 1; j <= 10; j+=1;){
|
||||
IO.Console->Print(' ')->Print(MultiFact(j, i));
|
||||
};
|
||||
IO.Console->PrintLine();
|
||||
};
|
||||
}
|
||||
}
|
||||
2
Task/Multifactorial/PARI-GP/multifactorial.pari
Normal file
2
Task/Multifactorial/PARI-GP/multifactorial.pari
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fac(n,d)=prod(k=0,(n-1)\d,n-k*d)
|
||||
for(k=1,5,for(n=1,10,print1(fac(n,k)" "));print)
|
||||
5
Task/Multifactorial/Perl-6/multifactorial.pl6
Normal file
5
Task/Multifactorial/Perl-6/multifactorial.pl6
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
sub mfact($n, :$degree = 1) { [*] $n, *-$degree ...^ * <= 0 }
|
||||
|
||||
for 1 .. 5 -> $degree {
|
||||
say "$degree: ", map &mfact.assuming(:$degree), 1 .. 10;
|
||||
}
|
||||
18
Task/Multifactorial/XPL0/multifactorial.xpl0
Normal file
18
Task/Multifactorial/XPL0/multifactorial.xpl0
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
code ChOut=8, CrLf=9, IntOut=11;
|
||||
|
||||
func MultiFac(N, D); \Return multifactorial of N in degree D
|
||||
int N, D;
|
||||
int F;
|
||||
[F:= 1;
|
||||
repeat F:= F*N;
|
||||
N:= N-D;
|
||||
until N <= 1;
|
||||
return F;
|
||||
];
|
||||
|
||||
int I, J; \generate table of multifactorials
|
||||
for J:= 1 to 5 do
|
||||
[for I:= 1 to 10 do
|
||||
[IntOut(0, MultiFac(I, J)); ChOut(0, 9\tab\)];
|
||||
CrLf(0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue