Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Van-Eck-sequence/XPL0/van-eck-sequence.xpl0
Normal file
23
Task/Van-Eck-sequence/XPL0/van-eck-sequence.xpl0
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
int Seq(1001), Back, N, M, Term;
|
||||
|
||||
func New; \Return 'true' if last term is new to sequence
|
||||
[for Back:= N-2 downto 1 do
|
||||
if Seq(Back) = Seq(N-1) then return false;
|
||||
return true;
|
||||
];
|
||||
|
||||
func VanEck; \Return term of Van Eck sequence
|
||||
[Seq(N):= if New then 0 else N-Back-1;
|
||||
N:= N+1;
|
||||
return Seq(N-1);
|
||||
];
|
||||
|
||||
[N:= 1;
|
||||
for M:= 1 to 1000 do
|
||||
[Term:= VanEck;
|
||||
if M<=10 or M>=991 then
|
||||
[IntOut(0, Term);
|
||||
if M=10 or M=1000 then Crlf(0) else Text(0, ", ");
|
||||
];
|
||||
];
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue