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 A366047 #21 Oct 07 2023 21:36:41 %S A366047 2,6,10,14,18,9,36,12,4,8,16,20,24,15,30,21,42,28,32,40,44,22,26,52, %T A366047 48,39,78,60,35,70,45,54,27,108,72,56,64,68,34,38,76,80,55,110,66,33, %U A366047 132,84,63,90,65,130,104,88,92,46,50,25,150,75,100,96,87,174,58,62,124,116,112,98,49,392 %N A366047 Starting with a(1) = 2, the lexicographically earliest infinite sequence of distinct positive integers such that |a(n) - a(n-1)| is a divisor of a(n)*a(n-1), where |a(n) - a(n-1)| is not a prime and greater than 1. %C A366047 For the sequence to be infinite no term can be a prime except for a(1) = 2. One can show that if a(n) is a prime p, then the only possible value for a(n-1) is 2p or p + p^2 since, if a term is prime, the preceding term must be a multiple of that prime. However the preceding term cannot be 2p since the difference between the terms would then be prime, therefore it must be p + p^2. However the only possible value for the term after a prime p is likewise p + p^2, but that has already been used, thus allowing a term to be prime would terminate the sequence. %H A366047 Scott R. Shannon, <a href="/A366047/b366047.txt">Table of n, a(n) for n = 1..10000</a>. %H A366047 Michael De Vlieger, <a href="/A366047/a366047.png">Log log scatterplot of a(n)</a> n = 1..1024, showing prime powers in gold, squarefree numbers in green, and numbers neither squarefree nor prime powers in blue, highlighting powerful numbers that are not prime powers in light blue. %e A366047 a(9) = 4 as |4 - a(8)| = |4 - 12| = 8, and 8 is a divisor of 4*12 = 48 and is not a prime. Note that |3 - 12| = 9 is a divisor of 3*12 = 36 and is not a prime, but as shown above a prime term will terminate the sequence so is not permitted. %t A366047 nn = 120; c[_] := False; s = {2, 6}; %t A366047 f[x_] := Times @@ FactorInteger[x][[All, 1]]; %t A366047 MapIndexed[Set[{a[First[#2]], c[#1]}, {#1, True}] &, s]; %t A366047 Set[{j, u}, {s[[-1]], 4}]; %t A366047 Do[k = u; %t A366047 While[Or[c[k], #1 < 4, PrimeQ[#1], %t A366047 ! Divisible[j*k, #1], ! Divisible[j, #2], ! Divisible[k, #2]] & @@ %t A366047 {#, f[#]} &@ Abs[j - k], k++]; %t A366047 Set[{a[n], c[k], j}, {k, True, k}]; %t A366047 If[k == u, While[Or[c[u], PrimeQ[u]], u++]], {n, Length[s] + 1, nn}]; %t A366047 Array[a, nn] (* _Michael De Vlieger_, Sep 29 2023 *) %Y A366047 Cf. A027750, A366111, A365984, A363576, A359799. %K A366047 nonn %O A366047 1,1 %A A366047 _Scott R. Shannon_, Sep 27 2023