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 A161185 #13 Feb 05 2025 00:36:29 %S A161185 2,3,7,11,17,19,29,31,37,41,43,47,53,67,71,73,79,83,89,97,103,107,109, %T A161185 113,127,131,137,139,149,151,157,163,167,173,181,191,193,199,211,223, %U A161185 227,229,233,239,241,251,257,263,271,277,281,283,293,307,311,313,317,337,347,349 %N A161185 First column of a table of all primes sorted by recursive look-up depending on the primality of their indices. %C A161185 We start from two lists of primes according to whether their indices are prime or nonprime, the first list being A007821, the second A006450: %C A161185 2,7,13,19,23,29,37,43,47,53,61,71,73,79,89,.. %C A161185 3,5,11,17,31,41,59,67,83,109,127,157,179,191,.. %C A161185 We construct rows of an intermediate table by transversing this double list, basically reading a number, then using this number as an index into the other list, reading the prime there, using it again as an index into the original list etc, alternating between the two lists. %C A161185 A new row is started from the smallest prime not contained in any earlier row (the "generator" of this row). The first row starts with 2, takes the 2nd entry of the other list (which is 5), takes the 5th entry from the original list (which is 23), then the 23rd entry of the other list etc. The 2nd row starts with 3 (the smallest prime not in the first row), takes the 3rd entry from the first list (which is 13), then the 13th entry from the 2nd list (which is 179), etc. %C A161185 By construction, the table contains each prime exactly once. The first column with the generators defines the sequence. %e A161185 The table with the generator in the first column and followup primes in the same row starts: %e A161185 2,5,23,431,3821,... %e A161185 3,13,179,1439,... %e A161185 7,59,419,... %e A161185 11,61,1847,... %e A161185 17,101,3943,... %e A161185 19,331,2833,... %e A161185 29,599,5507,... %e A161185 31,197,9739,... %e A161185 37,919,8861,... %e A161185 41,269,... %e A161185 43,1153,... %e A161185 47,1297,... %o A161185 (PARI) lista(nn) = my(v = primes(nn), vp = select(x->isprime(primepi(x)), v), vc = setminus(v, vp), list = List()); while (#v, my(p=v[1], q); listput(list, p); v = setminus(v, [p]); my(ok = 1); while(ok, if (vecsearch(vp, p), vx=vc; vy=vp, vx=vp; vy=vc); if (p > #vx, ok = 0, q = vx[p]; v = setminus(v, [q]); if (q > #vy, ok = 0, q = vy[q]; v = setminus(v, [q]); p = q;);););); Vec(list); \\ _Michel Marcus_, Oct 31 2022 %Y A161185 Cf. A141436. %K A161185 easy,nonn %O A161185 1,1 %A A161185 _Daniel Tisdale_, Jun 05 2009 %E A161185 Edited and extended by _R. J. Mathar_, Jun 23 2009 %E A161185 More terms from _Michel Marcus_, Oct 31 2022