%I #10 Oct 31 2022 11:18:16
%S 2,3,7,11,17,19,29,31,37,41,43,47,53,67,71,73,79,83,89,97,103,107,109,
%T 113,127,131,137,139,149,151,157,163,167,173,181,191,193,199,211,223,
%U 227,229,233,239,241,251,257,263,271,277,281,283,293,307,311,313,317,337,347,349
%N First column of a table of all primes sorted by recursive look-up depending on the primality of their indices.
%C 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 2,7,13,19,23,29,37,43,47,53,61,71,73,79,89,..
%C 3,5,11,17,31,41,59,67,83,109,127,157,179,191,..
%C 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 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), the 13th entry from the 2nd list, which is 179 etc.
%C By construction, the table contains each prime exactly once. The first column with the generators defines the sequence.
%e The table with the generator in the first column and followup primes in the same row starts
%e 2,5,23,431,3821,...
%e 3,13,179,1439,...
%e 7,59,419,...
%e 11,61,1847,...
%e 17,101,3943,...
%e 19,331,2833,...
%e 29,599,5507,...
%e 31,197,9739,...
%e 37,919,8861,...
%e 41,269,...
%e 43,1153,...
%e 47,1297,...
%o (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 Cf. A141436.
%K easy,nonn
%O 1,1
%A _Daniel Tisdale_, Jun 05 2009
%E Edited and extended by _R. J. Mathar_, Jun 23 2009
%E More terms from _Michel Marcus_, Oct 31 2022