login
A361929
a(1) = 2; for n > 1, a(n) is the smallest positive integer > 1 not to share a factor with terms a(n-c .. n-1) where c = gcd(n-1,a(n-1)).
2
2, 3, 2, 3, 2, 3, 5, 2, 3, 7, 2, 3, 5, 2, 3, 7, 2, 3, 5, 2, 3, 7, 2, 3, 5, 11, 2, 3, 2, 3, 5, 2, 3, 7, 2, 3, 5, 2, 3, 7, 2, 3, 5, 2, 3, 7, 2, 3, 5, 2, 3, 7, 2, 3, 5, 11, 2, 3, 2, 3, 5, 2, 3, 7, 2, 3, 5, 2, 3, 7, 11, 2, 3, 2, 5, 7, 2, 3, 5, 2, 3, 7, 2, 3, 5, 11
OFFSET
1,1
COMMENTS
Conjecture: All primes will occur. See A361931 for the first occurrences of primes.
a(p+1) = 2 or 3 when p is prime.
LINKS
EXAMPLE
For a(26), we see a(25) = 5. Then gcd(25,5) = 5, so a(26) must not share a factor with any of the previous 5 terms. The previous 5 terms {a(21), a(22), a(23), a(24), a(25)} = {3, 7, 2, 3, 5}, and the least positive number not to share a factor with {3, 7, 2, 3, 5} is 11, so a(26) = 11.
The first terms, alongside gcd(n,a(n)):
n a(n) gcd(n,(a(n))
- ---- ----
1 2 1
2 3 1
3 2 1
4 3 1
5 2 1
6 3 3
7 5 1
8 2 2
9 3 3
10 7 1
MATHEMATICA
K = {2}; While[Length@K < 86, p = 2; While[MemberQ[K[[Length@K - GCD[Length@K, Last@K] + 1 ;; Length@K]], p], p = NextPrime[p]]; AppendTo[K, p]]; Print[K]
PROG
(PARI) isok(w, k) = for (i=1, #w, if (gcd(k, w[i]) > 1 , return(0)); ); 1;
lista(nn) = my(va = vector(nn)); va[1] = 2; for (n=2, nn, my(k=2, ok = 0, w = vector(gcd(n-1, va[n-1]), i, va[n-i])); while (!ok, ok = isok(w, k); if (!ok, k++); ); va[n] = k; ); va; \\ Michel Marcus, Mar 31 2023
CROSSREFS
Cf. A358921, A361931 (indices of first occurrences).
Sequence in context: A276090 A073820 A103509 * A252941 A069898 A245511
KEYWORD
nonn
AUTHOR
Samuel Harkness, Mar 30 2023
STATUS
approved