Van Eck sequence: Difference between revisions

(Added Fōrmulæ)
Line 761:
<pre>0 0 1 0 2 0 2 2 1 6
4 7 30 25 67 225 488 0 10 136</pre>
 
=={{header|Nim}}==
<lang nim>const max = 1000
var a: array[max, int]
for n in countup(0, max - 2):
for m in countdown(n - 1, 0):
if a[m] == a[n]:
a[n + 1] = n - m
break
 
echo "The first ten terms of the Van Eck sequence are:"
echo $a[..9]
echo "\nTerms 991 to 1000 of the sequence are:"
echo $a[990..^1]</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|Pascal}}==
Anonymous user