Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,19 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Mfact is
function MultiFact (num : Natural; deg : Positive) return Natural is
Result, N : Integer := num;
begin
if N = 0 then return 1; end if;
loop
N := N - deg; exit when N <= 0; Result := Result * N;
end loop; return Result;
end MultiFact;
begin
for deg in 1..5 loop
Put("Degree"& Integer'Image(deg) &":");
for num in 1..10 loop Put(Integer'Image(MultiFact(num,deg))); end loop;
New_line;
end loop;
end Mfact;

View file

@ -8,8 +8,6 @@ func mfact n k .
.
for k = 1 to 5
write "degree " & k & ":"
for n = 1 to 10
write " " & mfact n k
.
for n = 1 to 10 : write " " & mfact n k
print ""
.

View file

@ -0,0 +1,38 @@
MODULE Multifactorial;
FROM STextIO IMPORT
WriteLn, WriteString;
FROM SWholeIO IMPORT
WriteInt;
VAR
Degree, N: INTEGER;
PROCEDURE MultiFactorial(N, Degree: INTEGER): INTEGER;
VAR
Result, I: INTEGER;
BEGIN
IF (N < 2) THEN
RETURN 1
ELSE
Result := N;
I := N - Degree;
WHILE I >= 2 DO
Result := Result * I;
I := I - Degree
END;
RETURN Result
END
END MultiFactorial;
BEGIN
FOR Degree := 1 TO 5 DO
WriteString("Degree ");
WriteInt(Degree, 1);
WriteString(" =>");
FOR N := 1 TO 10 DO
WriteString(" ");
WriteInt(MultiFactorial(N, Degree), 1);
END;
WriteLn;
END;
END Multifactorial.

View file

@ -0,0 +1,20 @@
<?php
// Multifactorial
for ($degree = 1; $degree <= 5; $degree++) {
echo 'Degree '.$degree.' => ';
for ($n = 1; $n <= 10; $n++)
echo multifactorial($n, $degree).' ';
echo PHP_EOL;
}
function multifactorial (int $n, int $degree): int {
if ($n < 2)
return 1;
else {
$result = $n;
for ($i = $n - $degree; $i >= 2; $i -= $degree)
$result = $result * $i;
return $result;
}
}
?>

View file

@ -0,0 +1,34 @@
program multifactorial(output);
var
n, degree: integer; (* Requires 32-bit integer *)
function multifactorial(n: integer; degree: integer): integer;
var
i, res: integer;
begin
if (n < 2) then
multifactorial := 1
else
begin
res := n;
i := n - degree;
while i >= 2 do
begin
res := res * i;
i := i - degree;
end;
multifactorial := res;
end;
end;
begin
for degree := 1 to 5 do
begin
write('Degree ', degree:1, ' =>');
for n := 1 to 10 do
write(' ', multifactorial(n, degree):1);
writeln;
end;
(* readln; *)
end.

View file

@ -0,0 +1,16 @@
local fmt = require "fmt"
local function mf(n, d)
local prod = 1
while n > 1 do
prod *= n
n -= d
end
return prod
end
for d = 1, 5 do
fmt.write("degree %d: ", d)
for n = 1, 10 do fmt.write("%8d", mf(n, d)) end
print()
end

View file

@ -0,0 +1,24 @@
# Multifactorial
function Get-Multifactorial {
param(
[uint32]$N,
[uint32]$Degree
)
if ($N -lt 2) {
return 1
} else {
[uint64]$result = $N
for ($i = $N - $Degree; $i -ge 2; $i -= $Degree) {
$result *= $i
}
return $result
}
}
foreach ($degree in 1..5) {
$out = "Degree $degree =>"
foreach ($n in 1..10) {
$out += " $(Get-Multifactorial $n $degree)"
}
Write-Output $out
}

View file

@ -0,0 +1,23 @@
' Multi factorial
DECLARE FUNCTION MultiFactorial& (N%, Degree%)
FOR Degree% = 1 TO 5
PRINT "Degree"; Degree%; "=>";
FOR N% = 1 TO 10
PRINT MultiFactorial&(N%, Degree%);
NEXT N%
PRINT
NEXT Degree%
END
FUNCTION MultiFactorial& (N%, Degree%)
IF (N% < 2) THEN
MultiFactorial& = 1
ELSE
Result& = N%
FOR I% = N% - Degree% TO 2 STEP -Degree%
Result& = Result& * I%
NEXT I%
MultiFactorial& = Result&
END IF
END FUNCTION

View file

@ -0,0 +1,2 @@
Fac ← ◌◌⍢(⊃(∘|-|⋅×)|⋅>₀)⊙⊙1 # step base
≡(≡˜Fac+1⇡10)+1⇡5

View file

@ -0,0 +1,25 @@
Function multifactorial(n,d)
If n = 0 Then
multifactorial = 1
Else
For i = n To 1 Step -d
If i = n Then
multifactorial = n
Else
multifactorial = multifactorial * i
End If
Next
End If
End Function
For j = 1 To 5
WScript.StdOut.Write "Degree " & j & ": "
For k = 1 To 10
If k = 10 Then
WScript.StdOut.Write multifactorial(k,j)
Else
WScript.StdOut.Write multifactorial(k,j) & " "
End If
Next
WScript.StdOut.WriteLine
Next