77 lines
1.7 KiB
Plaintext
77 lines
1.7 KiB
Plaintext
\\ set console 70 characters by 40 lines
|
|
Form 70, 40
|
|
Module CheckSubs {
|
|
Flush
|
|
Document one$, two$
|
|
For i =0 to 20
|
|
Print format$("{0::-3}",i);
|
|
f(i)
|
|
\\ number pop then top value of stack
|
|
one$=format$("{0::-3}",number)
|
|
m(i)
|
|
two$=format$("{0::-3}",number)
|
|
Next i
|
|
Print
|
|
Print one$
|
|
Print two$
|
|
Sub f(x)
|
|
if x<=0 then Push 1 : Exit sub
|
|
f(x-1) ' leave result to for m(x)
|
|
m()
|
|
push x-number
|
|
End Sub
|
|
Sub m(x)
|
|
if x<=0 then Push 0 : Exit sub
|
|
m(x-1)
|
|
f()
|
|
push x-number
|
|
End Sub
|
|
}
|
|
CheckSubs
|
|
|
|
Module Checkit {
|
|
Function global f(n) {
|
|
if n=0 then =1: exit
|
|
if n>0 then =n-m(f(n-1))
|
|
}
|
|
Function global m(n) {
|
|
if n=0 then =0
|
|
if n>0 then =n-f(m(n-1))
|
|
|
|
}
|
|
Document one$, two$
|
|
For i =0 to 20
|
|
Print format$("{0::-3}",i);
|
|
one$=format$("{0::-3}",f(i))
|
|
two$=format$("{0::-3}",m(i))
|
|
Next i
|
|
Print
|
|
Print one$
|
|
Print two$
|
|
}
|
|
Checkit
|
|
Module Checkit2 {
|
|
Group Alfa {
|
|
function f(n) {
|
|
if n=0 then =1: exit
|
|
if n>0 then =n-.m(.f(n-1))
|
|
}
|
|
function m(n) {
|
|
if n=0 then =0
|
|
if n>0 then =n-.f(.m(n-1))
|
|
}
|
|
}
|
|
Document one$, two$
|
|
For i =0 to 20
|
|
Print format$("{0::-3}",i);
|
|
one$=format$("{0::-3}",Alfa.f(i))
|
|
two$=format$("{0::-3}",Alfa.m(i))
|
|
Next i
|
|
Print
|
|
Print one$
|
|
Print two$
|
|
Clipboard one$+{
|
|
}+two$
|
|
}
|
|
Checkit2
|