OFFSET
1,2
COMMENTS
The sequence uses a similar selection rule to the Yellowstone permutation A098550 but instead of choosing the smallest number that has not occurred earlier that has a common factor with a(n-2) and no common factor with a(n-1), the number closest to a(n-1) that satisfies these rules is selected for a(n). If two such numbers are the same distance from a(n-1) then the smaller is chosen.
As any number n is coprime to n-1 there are many such pairs of values differing by one in the sequence. If a(n-1) is even and a(n) is odd then the only time a(n+1) will not be a(n)-1 is if a(n)-1 has already appeared in the sequence.
The majority of terms are clustered along a line with gradient approximately 1.25 . However the line is broken into smaller regions, each region having a slightly higher gradient, by the terms dropping to much smaller values before returning to the main line. See the linked image.
Excluding the first five terms, in the first 5 million terms the maximum number of consecutive terms that increase is only two. This only occurs at five places, when n=9,25,79,13705,275345. In the same range there are many regions of consecutive decreasing terms, the longest being 5997 terms starting from n=1902153.
In the first 5 million terms the only fixed points, other than the first three terms, are 4 and 313362. As the terms for larger n seem to drop below the a(n)=n line on numerous occasions it is possible more exist, although this is unknown. The smallest number not appearing is 31. It is unknown is all values eventually appear. In the same range the largest change in consecutive terms is from a(3503960)=30982 to a(3503961)=3191249, a difference of 3160267.
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..20000.
Scott R. Shannon, Image of the first 5 million terms. The green line is a(n)=n.
EXAMPLE
a(5) = 9 as a(5-2) = a(3) = 3 so a(5) must have 3 as a factor, but cannot be 6 as it cannot have common factor with a(5-1) = a(4) = 2.
a(12) = 24 as a(12-2) = a(10) = 6 so a(12) must have 2 or 3 as a factor, but cannot have a factor with a(12-1) = a(11) = 25. The closest numbers to a(12-1) = a(11) = 25 which have not occurred and satisfy these criteria are 24 and 26, but 24 is chosen as it is the smaller of the two. This is the first term differing from A098550 as the later chooses the smallest number satisfying the criteria that has not occurred, namely 12.
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Scott R. Shannon, Jan 21 2021
STATUS
approved