Yellowstone sequence: Difference between revisions

Content added Content deleted
(add PicoLisp)
(add Ruby)
Line 972: Line 972:
54 5256 0107291336581278545456109839254709038125616729183498741036627407016102613228322844546
54 5256 0107291336581278545456109839254709038125616729183498741036627407016102613228322844546
5 9 3 1 5 5 1 7 3 9 5 5 5 5 5
5 9 3 1 5 5 1 7 3 9 5 5 5 5 5
</pre>

=={{header|PicoLisp}}==
<lang ruby>def yellow(n)
a = [1, 2, 3]
b = { 1 => true, 2 => true, 3 => true }
i = 4
while n > a.length
if !b[i] && i.gcd(a[-1]) == 1 && i.gcd(a[-2]) > 1
a << i
b[i] = true
i = 4
end
i += 1
end
a
end

p yellow(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>
</pre>