Van Eck sequence: Difference between revisions
Added Arturo implementation
(→{{header|JavaScript}}: mapAccumL version: tidied, updated primitives.) |
Drkameleon (talk | contribs) (Added Arturo implementation) |
||
Line 894:
4 7 30 25 67 225 488 0 10 136
</pre>
=={{header|Arturo}}==
<lang rebol>Max: 1000
a: array.of: Max 0
loop 0..Max-2 'n [
if 0 =< n-1 [
loop (n-1)..0 'm [
if a\[m]=a\[n] [
a\[n+1]: n-m
break
]
]
]
]
print "The first ten terms of the Van Eck sequence are:"
print first.n:10 a
print ""
print "Terms 991 to 1000 of the sequence are:"
print last.n:10 a</lang>
{{out}}
<pre>The first ten terms of the Van Eck sequence are:
0 0 1 0 2 0 2 2 1 6
Terms 991 to 1000 of the sequence are:
4 7 30 25 67 225 488 0 10 136</pre>
=={{header|AWK}}==
<lang AWK>
|