Jump to content

Yellowstone sequence: Difference between revisions

(Added 11l)
Line 77:
First 30 Yellowstone numbers:
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>
 
{{trans|Ruby}}
 
<lang 11l>F yellow(n)
V a = [1, 2, 3]
V b = Set([1, 2, 3])
V i = 4
L n > a.len
I i !C b & gcd(i, a.last) == 1 & gcd(i, a[(len)-2]) > 1
a.append(i)
b.add(i)
i = 4
i++
R a
 
print(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>
 
1,481

edits

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