login
A377157
a(n) = n for n <= 3; for n > 3, a(n) is the smallest unused positive number that is coprime to a(n-1) if a(n-1) is prime and coprime to a(n-2) if a(n-2) is prime, else a(n) shares a factor with a(n-1) and a(n-2) if both are composite.
1
1, 2, 3, 5, 4, 6, 8, 10, 12, 14, 16, 18, 20, 15, 24, 9, 21, 27, 30, 33, 22, 11, 7, 13, 17, 19, 23, 25, 26, 40, 28, 32, 34, 36, 38, 42, 44, 46, 48, 50, 45, 35, 55, 60, 65, 39, 52, 54, 56, 58, 62, 64, 66, 68, 51, 72, 57, 63, 69, 75, 78, 70, 74, 76, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 85, 105, 95, 110, 114, 99, 81, 87, 93, 108, 111, 117, 120, 104
OFFSET
1,2
COMMENTS
Similar to A375564 the primes appear in clusters separated by runs of composites. However unlike A375564 the runs of primes are interrupted by occasional composites, typically toward the end of the run - see the attaching image of the first 5000 terms. The first prime in the runs can also be larger than one or more subsequent primes, so unlike A375564, the primes do not all occur in their natural order; in the first 3000000 terms the out-of-order primes are 11 and 3581.
The runs of primes also appear to occur much less frequently than in A375564 - the last known run begins at a(156233) = 3581 and ends at a(169394) = 146857, and no more primes appear up to 3000000 terms.
The fixed points begin 1, 2, 3, 6, 32, 57, 119, 343, 3123, 3859, 120481. The sequence is conjectured to be a permutation of the positive integers.
LINKS
Scott R. Shannon, Image of the first 5000 terms. The terms are colored red, yellow, green, blue, violet if they have one, two, three, four, or five or more prime factors. The thin white line is a(n) = n.
EXAMPLE
a(5) = 4 as both a(3) = 3 and a(4) = 5 are prime so a(5) must be coprime to both, and 4 is the smallest unused number coprime to both 3 and 5.
a(6) = 6 as a(4) = 5 is prime so a(6) must be coprime to a(4), and 6 is the smallest unused number coprime to 5.
a(7) = 8 as both a(5) = 4 and a(6) = 6 are composite so a(7) must share a factor with both, and 8 is the smallest unused number that shares a factor with both 4 and 6.
CROSSREFS
KEYWORD
nonn
AUTHOR
Scott R. Shannon, Oct 18 2024
STATUS
approved