A355212 A variant of the EKG sequence (A064413) where the least value not yet in the sequence appears as soon as possible.
1, 2, 6, 3, 12, 4, 10, 5, 35, 7, 14, 8, 18, 9, 33, 11, 143, 13, 39, 15, 20, 16, 34, 17, 323, 19, 57, 21, 24, 22, 46, 23, 115, 25, 30, 26, 36, 27, 42, 28, 58, 29, 899, 31, 62, 32, 74, 37, 148, 38, 40, 82, 41, 1763, 43, 86, 44, 48, 45, 141, 47, 329, 49, 56, 50
Offset: 1
Keywords
Examples
The first terms are (stars correspond to "w" terms): n a(n) w -- ---- - 1 1 2 2 3 6 * 4 3 5 12 * 6 4 7 10 * 8 5 9 35 * 10 7 11 14 * 12 8 13 18 * 14 9 15 33 * 16 11
Links
Programs
-
PARI
\\ See Links section.
-
Python
from math import gcd from itertools import count, islice def agen(): # generator of terms aset, an, v = {1, 2}, 2, 3; yield from [1, 2] for n in count(3): if gcd(an, v) == 1: w = v + 1 while w in aset or gcd(an, w) == 1 or gcd(w, v) == 1: w += 1 aset.add(w); yield w an = v; aset.add(an); yield an while v in aset: v += 1 print(list(islice(agen(), 65))) # Michael S. Branicky, Jun 24 2022
Comments