%I #21 May 30 2022 08:21:01
%S 3,5,17,31,41,59,67,83,109,157,179,191,211,241,283,331,353,367,401,
%T 431,461,509,547,563,587,599,617,709,739,773,797,859,877,919,967,991,
%U 1031,1087,1153,1171,1201,1217,1297,1409,1433,1447,1471,1499,1523,1597,1621
%N Primes p whose order of primeness A078442(p) is prime.
%H Alois P. Heinz, <a href="/A333353/b333353.txt">Table of n, a(n) for n = 1..10000</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]
%F { p in primes : A078442(p) is prime }.
%F a(n) = prime(A333364(n)).
%e 31 is a term: 31 -> 11 -> 5 -> 3 -> 2 -> 1, five (a prime number of) steps "->" = pi = A000720.
%p b:= proc(n) option remember;
%p `if`(isprime(n), 1+b(numtheory[pi](n)), 0)
%p end:
%p a:= proc(n) option remember; local p;
%p p:= `if`(n=1, 1, a(n-1));
%p do p:= nextprime(p);
%p if isprime(b(p)) then break fi
%p od; p
%p end:
%p seq(a(n), n=1..55);
%t b[n_] := b[n] = If[!PrimeQ[n], 0, 1+b[PrimePi[n]]];
%t okQ[n_] := PrimeQ[n] && PrimeQ[b[n]];
%t Select[Range[2000], okQ] (* _Jean-François Alcover_, May 30 2022 *)
%Y Cf. A000040, A000720, A049076, A078442, A236542, A262275, A333364.
%K nonn
%O 1,1
%A _Alois P. Heinz_, Mar 15 2020