Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
26
Task/Recamans-sequence/SETL/recamans-sequence.setl
Normal file
26
Task/Recamans-sequence/SETL/recamans-sequence.setl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
program recaman;
|
||||
a := {[0,0]};
|
||||
|
||||
loop for i in [1..14] do
|
||||
extend(a);
|
||||
end loop;
|
||||
|
||||
print("First 15:", [a(n) : n in [0..14]]);
|
||||
|
||||
loop
|
||||
doing n := extend(a);
|
||||
until #(rept:=[[r,i] : r = a(i) | r=n]) > 1
|
||||
do pass;
|
||||
end loop;
|
||||
|
||||
print("First repetition:", n, "at", {x:x in rept}{n});
|
||||
|
||||
proc extend(rw a);
|
||||
n := max/ domain a;
|
||||
t := a(n) - n-1;
|
||||
if t<0 or t in range a then
|
||||
t := a(n) + n+1;
|
||||
end if;
|
||||
return a(n+1) := t;
|
||||
end proc;
|
||||
end program;
|
||||
Loading…
Add table
Add a link
Reference in a new issue