Data update

This commit is contained in:
Ingy döt Net 2023-12-16 21:33:55 -08:00
parent 35bcdeebf8
commit 74c69a0df6
2427 changed files with 31826 additions and 3468 deletions

View file

@ -0,0 +1,21 @@
on multifactorial(n, d)
set f to 1
repeat with n from n to 2 by -d
set f to f * n
end repeat
return f
end multifactorial
on task()
set table to ""
repeat with degree from 1 to 5
set row to linefeed & "Degree " & degree & ":"
repeat with n from 1 to 10
set row to row & (space & multifactorial(n, degree))
end repeat
set table to table & row
end repeat
return table
end task
task()

View file

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

View file

@ -0,0 +1,3 @@
MultiFact ×´-÷×
MultiFact(5) 1+10

View file

@ -0,0 +1,24 @@
include "cowgol.coh";
sub multifac(n: uint32, d: uint32): (r: uint32) is
r := 1;
loop
r := r * n;
if n <= d then break; end if;
n := n - d;
end loop;
end sub;
var d: uint32 := 1;
while d <= 5 loop
print_i32(d);
print(": ");
var n: uint32 := 1;
while n <= 10 loop
print_i32(multifac(n, d));
print(" ");
n := n + 1;
end loop;
print_nl();
d := d + 1;
end loop;

View file

@ -0,0 +1,15 @@
func mfact n k .
r = 1
while n > 1
r *= n
n -= k
.
return r
.
for k = 1 to 5
write "degree " & k & ":"
for n = 1 to 10
write " " & mfact n k
.
print ""
.

View file

@ -0,0 +1,8 @@
multifactorial(x,n):=genfact(x,x/n,n)$
/* Test case */
makelist(multifactorial(i,1),i,1,10);
makelist(multifactorial(i,2),i,1,10);
block(makelist(mod(i,3),i,1,10),at(%%,0=1),%%*makelist(multifactorial(i,3),i,1,10));
block(makelist(mod(i,4),i,1,10),at(%%,0=1),%%*makelist(multifactorial(i,4),i,1,10));
block(makelist(mod(i,5),i,1,10),at(%%,0=1),%%*makelist(multifactorial(i,5),i,1,10));

View file

@ -0,0 +1,13 @@
(define (multifactorial n d)
(fold * 1 (iota (div n d) n (negate d))))
(for-each (lambda (i)
(display "Degree ")
(display i)
(display ":")
(for-each (lambda (n)
(display " ")
(display (multifactorial n i)))
(iota 10 1))
(print))
(iota 5 1))

View file

@ -0,0 +1,11 @@
(define (!!!!! n) (multifactorial n 5))
(print (!!!!! 74))
(import (math infix-notation))
; register !!!!! as a postfix function
(define \\postfix-functions (put \\postfix-functions '!!!!! #t))
; now use "\\" as usual
(print (\\
2 + 74!!!!!
))

View file

@ -0,0 +1,9 @@
program multifactorial;
loop for d in [1..5] do
print(d, ":", [multifac(n, d) : n in [1..10]]);
end loop;
proc multifac(n, d);
return */{n, (n-d)..1};
end proc;
end program;