OFFSET
1,1
COMMENTS
Does every positive integer > 1 appear eventually?
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
The sequence and blocks begin
n = 1 2 3 4 5 6 7 8 9 ...
a(n) = 2,4, 3,6,2,4, 3,6,2, 3,6,2,4,8,10, 3,6, ...
block \-/ \-----/ \---/ \----------/ \-/
length 2 4 3 6 2 ...
a(7) = 3 is the start of a new block since it has no common factor with the preceding a(6) = 4.
The block lengths are the sequence itself.
PROG
(Python)
from math import gcd
from itertools import count, islice
def agen(): # generator of terms
n, an, alst = 1, 2, [-3]
while True:
b = [next(i for i in count(2) if gcd(i, alst[-1])==1)]
for i in range(an-1):
b += [next(j for j in count(2) if j not in b and gcd(j, b[-1])!=1)]
yield from b
alst.extend(b)
n, an = n+1, alst[n+1]
print(list(islice(agen(), 95))) # Michael S. Branicky, Sep 02 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Bryle Morga, Sep 02 2024
STATUS
approved