A375907 Lexicographically earliest sequence where a(n) is the length of the n-th block of distinct integers sharing a prime factor.
2, 4, 3, 6, 2, 4, 3, 6, 2, 3, 6, 2, 4, 8, 10, 3, 6, 5, 10, 2, 4, 3, 6, 2, 3, 6, 2, 4, 8, 10, 3, 6, 5, 10, 2, 3, 6, 2, 4, 8, 10, 3, 6, 5, 10, 2, 4, 3, 6, 2, 4, 8, 10, 5, 15, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, 2, 4, 6, 5, 10, 2, 4, 6, 3, 2, 4, 6, 3, 9, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, 2, 4, 3, 6, 2, 4
Offset: 1
Keywords
Examples
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.
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
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
Comments