%I #17 Jun 30 2020 14:37:51
%S 5,17,353,859,4787,5441,6353,6841,7883,12503,13037,16061,18617,20959,
%T 25357,29137,33029,38351,39199,44729,46237,69491,80429,82217,85597,
%U 89989,92779,97001,107903,129287,132611,139661,170707,172721,187123,230453,238943,242129,257689,259151,292841,312773,328789,341423,346147
%N Prime-indexed primes q such that prime(q)-q-1 is a prime indexed prime.
%C This sequence and the sequence of resulting primes, prime(q)-q-1 (5, 41, 2027, 5801, 41491, ...), are subsequences of A006450, the prime-indexed primes.
%H Harvey P. Dale, <a href="/A318751/b318751.txt">Table of n, a(n) for n = 1..500</a>
%H N. Fernandez, <a href="http://www.borve.org/primeness/FOP.html">An order of primeness, F(p)</a>
%H N. Fernandez, <a href="/A006450/a006450.html">An order of primeness</a> [cached copy, included with permission of the author]
%p N := 1000000;
%p for n to N do
%p if isprime(n) then q := ithprime(n);
%p Z := numtheory[pi](n);
%p S := q-n-1;
%p W := numtheory[pi](S);
%p if isprime(Z) and isprime(S) and isprime(W) then print(n);
%p end if:
%p end if:
%p end do:
%t pipQ[n_]:=Module[{c=Prime[n]-n-1},AllTrue[{PrimePi[n],c, PrimePi[ c]}, PrimeQ]]; Select[Prime[Range[30000]],pipQ] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jun 30 2020 *)
%o (PARI) isok(p) = isprime(p) && isprime(primepi(p)) && isprime(q=prime(p)-p-1) && isprime(primepi(q)); \\ _Michel Marcus_, Sep 03 2018
%Y Cf. A000040, A006450, A318292, A318752.
%K nonn
%O 1,1
%A _David James Sycamore_, Sep 02 2018
%E Corrected and extended by _Harvey P. Dale_, Jun 30 2020