A354755 a(1) = 1, a(2) = 2; for n > 2, a(n) is the smallest positive number that shares a factor with a(n-1) and the sum a(n) + a(n-1) is distinct from all previous sums a(i) + a(i-1), i=2..n-1.
1, 2, 2, 4, 4, 6, 3, 9, 6, 8, 8, 10, 10, 12, 9, 15, 10, 16, 12, 15, 15, 18, 14, 20, 15, 21, 18, 20, 20, 22, 22, 24, 21, 27, 24, 26, 26, 28, 21, 35, 20, 38, 19, 57, 3, 60, 2, 62, 4, 64, 6, 63, 9, 66, 8, 70, 7, 77, 11, 88, 2, 78, 3, 84, 2, 80, 5, 60, 32, 62, 31, 93, 3, 99, 6, 92, 8, 96, 10, 85, 25
Offset: 1
Examples
a(7) = 3 as a(6) = 6, and 3 is the smallest number that shares a factor with 6 and whose sum with the previous term, 6 + 3 = 9, has not appeared. Note 2 shares a factor with 6 but 6 + 2 = 8, and a sum of 8 has already occurred with a(4) + a(5) = 4 + 4 = 8, so 2 cannot be chosen.
Links
- Michael De Vlieger, Table of n, a(n) for n = 1..10000
- Michael De Vlieger, Annotated log-log scatterplot of a(n) n = 1..2^14, showing records in red and a(n) = 2 in blue, highlighting fixed points in gold.
- Scott R. Shannon, Image of the first 500000 terms. The green line is y = n.
Programs
-
Mathematica
nn = 120; c[] = 0; a[1] = c[1] = 1; a[2] = j = 2; c[3] = 2; Do[k = 2; While[Nand[c[j + k] == 0, ! CoprimeQ[j, k]], k++]; Set[{a[n], c[j + k]}, {k, n}]; j = k, {n, 3, nn}]; Array[a, nn] (* _Michael De Vlieger, Jun 15 2022 *)
-
PARI
lista(nn) = my(va = vector(nn), vs = vector(nn-2)); va[1] = 1; va[2] = 2; for (n=3, nn, my(k=2); while ((gcd(k, va[n-1]) == 1) || #select(x->(x==k+va[n-1]), vs), k++); va[n] = k; vs[n-2] = k+va[n-1];); va; \\ Michel Marcus, Jun 15 2022
Comments