OFFSET
1,2
COMMENTS
For the terms studied the primes appear in their natural order. The fixed points being 3, 8, 10, 11, 18, 21, 26, 28, 29, 43, 51, 64... . After 10 million terms 3211449 of them, approximately 32.1%, share a factor with both previous terms - it is unknown what this ratio is as n -> infinity. The sequence is almost certainly a permutation of the positive numbers.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..10000
EXAMPLE
a(4) = 5 as 5 is coprime to both a(3) = 3 and a(2) = 2, and 5 has not previously appeared.
a(9) = 6 as 6 shares a factor with both a(8) = 8 and a(7) = 9, and 6 has not previously appeared.
MATHEMATICA
nn = 120; c[_] := False; Do[Set[{a[n], c[k]}, {n, True}], {n, 2}];
i = a[1]; j = a[2]; u = 3;
Do[k = u;
While[Or[c[k], Nor[And[#1, #2], Nor[#1, #2]]] &[
CoprimeQ[k, i], CoprimeQ[k, j]], k++];
Set[{a[n], c[k], i, j}, {k, True, j, k}];
If[k == u, While[c[u], u++]], {n, 3, nn}];
Array[a, nn] (* Michael De Vlieger, Dec 17 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Dec 17 2024
STATUS
approved