Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,45 @@
|
|||
[ ' [ 1 3 7 ]
|
||||
' [ 2 4 5 6 ] ] is initialise ( --> r s )
|
||||
|
||||
[ over size 1 -
|
||||
over swap peek
|
||||
dip [ over -1 peek ]
|
||||
+ swap dip join
|
||||
over -2 split nip do
|
||||
temp put
|
||||
1 + from
|
||||
[ temp share
|
||||
index = iff
|
||||
end done
|
||||
index join ]
|
||||
temp release ] is extend ( r s --> r s )
|
||||
|
||||
[ temp put
|
||||
[ over size
|
||||
temp share < while
|
||||
extend again ]
|
||||
over
|
||||
temp take 1 - peek ] is ffr ( r s n --> r s n )
|
||||
|
||||
[ temp put
|
||||
[ dup size
|
||||
temp share < while
|
||||
extend again ]
|
||||
dup
|
||||
temp take 1 - peek ] is ffs ( r s n --> r s n )
|
||||
|
||||
initialise
|
||||
say "R(1)..R(10): "
|
||||
10 times
|
||||
[ i^ 1+ ffr echo sp ]
|
||||
cr cr
|
||||
960 ffs drop
|
||||
960 split drop
|
||||
dip [ 40 split drop ]
|
||||
join sort
|
||||
[] 1000 times
|
||||
[ i^ 1+ join ]
|
||||
!=
|
||||
say "All integers from 1 to 1000"
|
||||
if say " not"
|
||||
say " found once and only once."
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
program figure_figure;
|
||||
init R := [1], S := [2];
|
||||
|
||||
print("R(1..10):", [ffr(n) : n in [1..10]]);
|
||||
print("R(1..40) + S(1..960) = {1..1000}:",
|
||||
{ffr(n) : n in {1..40}} + {ffs(n) : n in {1..960}} = {1..1000});
|
||||
|
||||
proc ffr(n);
|
||||
loop while n > #R do
|
||||
nextR := R(#R) + S(#R);
|
||||
S +:= [S(#S)+1 .. nextR-1];
|
||||
R with:= nextR;
|
||||
S with:= nextR + 1;
|
||||
end loop;
|
||||
return R(n);
|
||||
end proc;
|
||||
|
||||
proc ffs(n);
|
||||
loop while n > #S do
|
||||
ffr(#R + 1);
|
||||
end loop;
|
||||
return S(n);
|
||||
end proc;
|
||||
end program;
|
||||
Loading…
Add table
Add a link
Reference in a new issue