Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -0,0 +1,25 @@
int F(int n, int x, int y) {
if (n == 0) return x + y;
if (y == 0) return x;
return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y);
}
for (int n = 0; n <= 1; ++n) {
write("Values of F(", n, suffix=none);
write(", x, y ):");
write("-----------------------------");
for (int y = 0; y <= 6; ++y) {
write(y, suffix=none);
write(" |", suffix=none);
for (int x = 0; x <= 5; ++x) {
write(" ", F(n, x, y), suffix=none);
}
write();
}
write();
}
write("F(0,0,0) = ", F(0, 0, 0));
write("F(1,3,3) = ", F(1, 3, 3));
write("F(2,1,1) = ", F(2, 1, 1));
write("F(3,1,1) = ", F(3, 1, 1));
write("F(2,2,1) = ", F(2, 2, 1));

View file

@ -0,0 +1,23 @@
100 sub f(n,x,y)
110 if n = 0 then f = x+y : exit sub
120 if y = 0 then f = x : exit sub
130 f = f(n-1,f(n,x,y-1),f(n,x,y-1)+y)
140 end sub
150 for n = 0 to 1
160 print using " Values of F(#, x, y ):";n
170 print " y/x 0 1 2 3 4 5"
180 print " -----------------------------"
190 for y = 0 to 6
200 print y;" |";
210 for x = 0 to 5
220 print using "####";f(n,x,y);
230 next x
240 print
250 next y
260 print
270 next n
280 print "F(0,0,0) = ";f(0,0,0)
290 print "F(1,3,3) = ";f(1,3,3)
300 print "F(2,1,1) = ";f(2,1,1)
310 print "F(3,1,1) = ";f(3,1,1)
320 print "F(2,2,1) = ";f(2,2,1)

View file

@ -0,0 +1,9 @@
ClearAll[sudan];
sudan[0, x_Integer?NonNegative, y_Integer?NonNegative] := x + y;
sudan[n_Integer?NonNegative, y_Integer?NonNegative, 0] := y;
sudan[n_Integer?NonNegative, x_Integer?NonNegative,
y_Integer?NonNegative] :=
sudan[n - 1, sudan[n, x, y - 1], sudan[n, x, y - 1] + y];
sudan @@@ {{0, 0, 0}, {1, 1, 1}, {1, 3, 3}, {2, 1, 1}, {2, 2, 1}, {3, 1, 1}}

View file

@ -0,0 +1,37 @@
uses console
'
function F(int n, x, y) as int
if n = 0 then
function = x + y
exit function
endif
if y = 0 then
function = x
exit function
endif
function = F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
end function
'
int n, x, y
for n = 0 to 1
printl " Values of F(" n ", x, y ):"
printl " y/x 0 1 2 3 4 5"
printl string(52, "-")
for y = 0 to 6
print " " y " |" tab
for x = 0 to 5
print F(n, x, y) tab
next x
printl
next y
printl
next n
'
printl "F(0,0,0) = " F(0, 0, 0)
printl "F(1,3,3) = " F(1, 3, 3)
printl "F(2,1,1) = " F(2, 1, 1)
printl "F(3,1,1) = " F(3, 1, 1)
printl "F(2,2,1) = " F(2, 2, 1)
printl cr "Enter ..."
waitkey