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 A373290 #11 May 31 2024 14:38:34 %S A373290 1,9,4,3,6,5,8,7,2,11,10,13,12,17,19,23,14,29,15,31,37,41,16,43,47,53, %T A373290 59,61,18,67,20,71,73,79,83,89,21,97,101,103,22,107,24,109,113,127,25, %U A373290 131,137,139,149,151,26,157,163,167,173,179,27,181,28,191,193 %N A373290 a(1) = 1. Thereafter, for n prime a(n) is the smallest composite number not already a term which is not divisible by n, and for n composite a(n) is the smallest prime not already a term, which does not divide n. %C A373290 {a(1),a(2),...,a(9)} is a self-inverse permutation of the first 9 terms of A026239, and for n >= 10 a(n) = A026239(n). Since A026239 is a self-inverse permutation of the natural numbers, so is this sequence (but primes < 11 are not in order). %H A373290 Michael De Vlieger, <a href="/A373290/b373290.txt">Table of n, a(n) for n = 1..10000</a> %H A373290 Michael De Vlieger, <a href="/A373290/a373290.png">Log log scatterplot of a(n)</a>, n = 1..10^4, showing primes in red and nonprimes in blue. %e A373290 For n = 2, (prime), a(2) = 9, the smallest composite number not divisible by 2. %e A373290 For n = 6, (composite), a(6) = 5, the smallest novel prime which does not divide 6. %t A373290 nn = 120; c[_] := False; a[1] = 1; c[1] = True; u = 2; v = 4; %t A373290 Do[If[PrimeQ[n], %t A373290 k = v; While[Or[c[k], PrimeQ[k], Divisible[k, n]], k++], %t A373290 k = u; While[Or[c[k], CompositeQ[k], Divisible[n, k]], k++]]; %t A373290 Set[{a[n], c[k]}, {k, True}]; %t A373290 If[k == u, While[Or[c[u], CompositeQ[u]], u++]]; %t A373290 If[k == v, While[Or[c[v], PrimeQ[v]], v++]], {n, 2, nn}]; %t A373290 Array[a, nn] (* _Michael De Vlieger_, May 31 2024 *) %Y A373290 Cf. A000027, A000040, A002808, A026239. %K A373290 nonn %O A373290 1,2 %A A373290 _David James Sycamore_, May 30 2024 %E A373290 More terms from _Michael De Vlieger_, May 31 2024