Yellowstone sequence: Difference between revisions

Added Arturo implementation
(Added Arturo implementation)
Line 100:
</pre>
 
=={{header|Arturo}}==
 
<lang rebol>yellowstone: function [n][
result: new [1 2 3]
present: new [1 2 3]
start: new 4
while [n > size result][
candidate: new start
while ø [
if all? @[
not? contains? present candidate
1 = gcd @[candidate last result]
1 <> gcd @[candidate get result (size result)-2]
][
'result ++ candidate
'present ++ candidate
while [contains? present start] -> inc 'start
break
]
inc 'candidate
]
]
return result
]
 
print yellowstone 30</lang>
 
{{out}}
 
<pre>1 2 3 4 9 8 15 14 5 6 25 12 35 16 7 10 21 20 27 22 39 11 13 33 26 45 28 51 32 17</pre>
=={{header|C}}==
{{trans|Ruby}}
1,532

edits