login
A387682
a(1) = 1, a(2) = 2, a(3) = 4; for n > 3, a(n) is the smallest unused positive number that shares a factor with a(n-1) and a(n-2) if a(n-1) > a(n-2), else it is coprime to a(n-1) and a(n-2) if a(n-1) < a(n-2).
3
1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 15, 7, 11, 77, 22, 3, 5, 30, 25, 13, 9, 17, 51, 34, 19, 21, 57, 24, 23, 29, 667, 58, 27, 31, 93, 62, 35, 33, 26, 37, 74, 111, 36, 41, 82, 123, 42, 43, 86, 129, 48, 47, 49, 329, 28, 39, 52, 54, 32, 53, 106, 159, 60, 59, 61
OFFSET
1,2
COMMENTS
The overall size of the graph of the terms is dominated by terms which are the product of two preceding prime terms, the first example being a(15) = 77; there are 35 such products in the first 10000 terms. For terms less than 3*n the graph shows the terms are concentrated along various lines, with the upper terms all being semiprimes - see the attached colored image.
For the terms studied the primes, other than 3 and 5, appear in their natural order, and the only two fixed points are the first two terms. The sequence is conjectured to be a permutation of the positive numbers.
LINKS
Scott R. Shannon, Image of the first 20000 terms for a(n) <= 60000. The colors are graduated across the spectrum to show the total number of prime factors of each term, with red being one prime factor. The thin green line is a(n) = n.
EXAMPLE
a(12) = 15 as a(11) = 20 > a(10) = 18, and 15 is the smallest unused number that shares a factor with both 20 and 18.
a(13) = 7 as a(12) = 15 < a(11) = 20, and 7 is the smallest unused number that is coprime to both 15 and 20.
MATHEMATICA
s={1, 2, 4}; Do[If[s[[-1]]>s[[-2]], AppendTo[s, m=2; Until[!CoprimeQ[s[[-1]], m]&&!CoprimeQ[s[[-2]], m]&&!MemberQ[s, m], m++]; m], AppendTo[s, m=2; Until[CoprimeQ[s[[-1]], m]&&CoprimeQ[s[[-2]], m]&&!MemberQ[s, m], m++]; m]], {i, 63}]; s (* James C. McMahon, Sep 13 2025 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Sep 05 2025
STATUS
approved