OFFSET
1,2
COMMENTS
The sequence forms a repetitive pattern of three even numbers separated by 2 followed by three odd numbers separated by 2, the first odd number being 3 less than the third even number. One third of all terms are fixed points, and the primes appear in their natural order.
First differences repeat {1, 2, 2, -3, 2, 2}. - Michael De Vlieger, Jun 11 2024
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Labeled scatterplot of a(n) n = 1..72, with red indicating prime, gold indicating odd, and dark blue indicating even terms.
EXAMPLE
a(9) = 10 as a(8) = 8 is an even number and 10 is the smallest unused positive number to share a factor with 8.
MATHEMATICA
kk = 2; nn = 120; c[_] := False; Array[Set[{a[#], c[#]}, {#, True}] &, kk];
j = a[kk]; u = kk + 1;
Do[If[EvenQ[j],
If[PrimePowerQ[j],
p = FactorInteger[j][[1, 1]];
k = #1 + Boole[#2 > 0] & @@ QuotientRemainder[u, p];
While[c[k p], k++]; k *= p,
k = u; While[Or[c[k], CoprimeQ[j, k]], k++]],
k = u; While[Or[c[k], ! CoprimeQ[j, k]], k++] ];
Set[{a[n], c[k], j}, {k, True, k}];
If[k == u, While[c[u], u++]], {n, kk + 1, nn}];
Array[a, nn] (* Michael De Vlieger, Jun 11 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Jun 09 2024
STATUS
approved
