This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A340807 #22 Feb 03 2021 10:51:55 %S A340807 1,2,3,4,9,8,15,14,5,12,25,16,35,18,49,20,63,22,57,26,51,28,45,32,39, %T A340807 34,33,38,27,40,21,44,7,46,77,48,91,50,117,55,114,65,112,75,116,69, %U A340807 118,81,122,87,124,99,128,93,130,111,134,105,136,95,138,85,141,80,147,82,153,86,159,88 %N A340807 a(n) = n if n <= 3; for n > 3, a(n) is the closest number to a(n-2) that has not occurred earlier and has at least one common factor with a(n-2), but none with a(n-1). In case of a tie, choose the smaller. %C A340807 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-2) that satisfies these rules is selected for a(n). If two such numbers are the same distance from a(n-2) then the smaller is chosen. %C A340807 Many terms are clustered along a line with gradient approximately 1.33. However, along this line the terms often rapidly drop to much smaller values before returning to the main line. More interesting is the existence of regions on the same line where the terms split and form two lines of constantly increasing values. These lines continue until they both start decreasing again to rejoin near the original line. %C A340807 In the first 15 million terms the maximum number of consecutive increasing terms is seven. This run starts at n = 47685. The maximum number of consecutive decreasing terms is also seven. This starts at n = 4134621. %C A340807 In the first 15 million terms the fixed points, other than the first three terms, are 4, 323, 516718, 2199679, 2401224. As the terms for larger n seem to drop below the a(n)=n line on numerous occasions, it is possible that more exist, although this is unknown. The smallest number not appearing is 6, although other small values appear after many terms, e.g. a(4946191) = 23. It is unknown if all values eventually appear. The largest change in consecutive terms is from a(399922)=527754 to a(399923)=2887, a difference of 524867. %C A340807 See also A340783 where the next term is the closest to a(n-1). %H A340807 Scott R. Shannon, <a href="/A340807/b340807.txt">Table of n, a(n) for n = 1..10000</a>. %H A340807 Scott R. Shannon, <a href="/A340807/a340807.png">Image of the first 500 thousand terms</a>. The green line is a(n)=n. %H A340807 Scott R. Shannon, <a href="/A340807/a340807_1.png">Image of the first 15 million terms</a>. The green line is a(n)=n. %H A340807 Rémy Sigrist, <a href="/A340807/a340807.gp.txt">PARI program for A340807</a> %e A340807 a(5) = 9 as a(5-2) = a(3) = 3 so a(5) must have 3 as a factor, but cannot be 6 = 3*2 as it cannot have a common factor with a(5-1) = a(4) = 2. %e A340807 a(12) = 16 as a(12-2) = a(10) = 12 so a(12) must have 2 or 3 as a factor, but cannot have a common factor with a(12-1) = a(11) = 25 = 5*5. The closest numbers to a(12-2) = a(10) = 12 which have 2 or 3 as a factor but not 5 are 8,9,14,16. The first three have already appeared so a(12) = 16. %o A340807 (PARI) See Links section. %Y A340807 Cf. A098550, A340783, A336957, A064413, A121216. %K A340807 nonn,look %O A340807 1,2 %A A340807 _Scott R. Shannon_, Jan 22 2021