OFFSET
1,2
COMMENTS
For the terms studied all primes appear in their natural order, and approximately 65% of all primes p are immediately followed by a term 2*p. These later terms form the upper of the two lines in the graph.
In the first 100000 terms the fixed points are 1, 2, 12, 18, 98, 182, 306, 380; it is likely no more exist.
The sequence is a permutation of the positive integers as the lowest unused number after k terms will always appear as it will eventually be coprime to a(j) for some j > k.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..10000
EXAMPLE
a(3) = 4 as a(2) = 2 and 4 > 2 and shares a factor with it. Note 3 cannot be chosen as 3 > 2 but is coprime to 2.
a(4) = 3 as a(3) = 4 and 3 < 4 and is coprime to it.
MATHEMATICA
nn = 120; c[_] := False; j = 2; u = 3; c[1] = c[2] = True;
{1, 2}~Join~Reap[Do[k = u;
While[And[k < j, Or[c[k], ! CoprimeQ[j, k]]], k++];
If[k >= j,
If[PrimePowerQ[j],
Set[{p, k}, {FactorInteger[j][[1, 1]], 1}]; While[c[k*p], k++]; k *= p,
While[Or[c[k], CoprimeQ[j, k]], k++] ] ];
Sow[k]; Set[{c[k], j}, {True, k}];
If[k == u, While[c[u], u++]],
{n, 3, nn}] ][[-1, 1]] (* Michael De Vlieger, May 27 2025 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, May 18 2025
STATUS
approved
