RosettaCodeData/Task/Yellowstone-sequence/Arturo/yellowstone-sequence.arturo
2026-02-01 16:33:20 -08:00

24 lines
617 B
Text

yellowstone: function [n][
result: [1 2 3]
present: [1 2 3]
start: 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