Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
25
Task/Sudan-function/Pluto/sudan-function.pluto
Normal file
25
Task/Sudan-function/Pluto/sudan-function.pluto
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
local fmt = require "fmt"
|
||||
|
||||
local function F(n, x, y)
|
||||
if n == 0 then return x + y end
|
||||
if y == 0 then return x end
|
||||
return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
|
||||
end
|
||||
|
||||
for n = 0, 1 do
|
||||
print($"Values of F({n}, x, y):")
|
||||
print("y/x 0 1 2 3 4 5")
|
||||
print("----------------------------")
|
||||
for y = 0, 6 do
|
||||
io.write($"{y} |")
|
||||
for x = 0, 5 do
|
||||
local sudan = F(n, x, y)
|
||||
fmt.write("%4d", sudan)
|
||||
end
|
||||
print()
|
||||
end
|
||||
print()
|
||||
end
|
||||
print($"F(2, 1, 1) = {F(2, 1, 1)}")
|
||||
print($"F(3, 1, 1) = {F(3, 1, 1)}")
|
||||
print($"F(2, 2, 1) = {F(2, 2, 1)}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue