Jump to content

Van Eck sequence: Difference between revisions

no edit summary
(Added Arturo implementation)
No edit summary
Line 3,186:
{{out}}
Same as C#.
 
=={{header|Vlang}}==
{{trans|go}}
<lang vlang>fn main() {
max := 1000
mut a := []int{len: max} // all zero by default
for n in 0..max-1 {
for m := n - 1; m >= 0; m-- {
if a[m] == a[n] {
a[n+1] = n - m
break
}
}
}
println("The first ten terms of the Van Eck sequence are:")
println(a[..10])
println("\nTerms 991 to 1000 of the sequence are:")
println(a[990..])
}</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|Wren}}==
338

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.