%I #10 Aug 09 2015 08:26:10
%S 2,23,37,67,71,101,103,109,127,137,139,151,157,179,191,197,199,211,
%T 227,233,239,241,257,263,271,277,281,283,311,331,347,353,359,367,373,
%U 379,389,401,419,431,443,457,461,467,499,503,509,521,523,541,547,557,563
%N Primes of the form r(r(r(r(n)+1)+1)+1)+1, where A141468(n) = r(n) = n-th nonprime.
%e n=1:
%e r(r(r(r(1)+1)+1)+1)+1=r(r(r(0+1)+1)+1)+1=r(r(r(1)+1)+1)+1=r(r(0+1)+1)+1=r(r(1)+1)+1=r(0+1)+1=r(1)+1=0+1=1
%e (nonprime).
%e n=2:
%e r(r(r(r(2)+1)+1)+1)+1=r(r(r(1+1)+1)+1)+1=r(r(r(2)+1)+1)+1=r(r(1+1)+1)+1=r(r(2)+1)+1=r(1+1)+1=r(2)+1=1+1=2=a(1).
%e n=3:
%e r(r(r(r(3)+1)+1)+1)+1=r(r(r(4+1)+1)+1)+1=r(r(r(5)+1)+1)+1=r(r(8+1)+1)+1=r(r(9)+1)+1=r(14+1)+1=r(15)+1=22+1=23=a(2).
%e n=4:
%e r(r(r(r(4)+1)+1)+1)+1=r(r(r(6+1)+1)+1)+1=r(r(r(7)+1)+1)+1=r(r(10+1)+1)+1=r(r(11)+1)+1=r(16+1)+1=r(17)+1=25+1=26
%e (nonprime).
%e n=5:
%e r(r(r(r(5)+1)+1)+1)+1=r(r(r(8+1)+1)+1)+1=r(r(r(9)+1)+1)+1=r(r(14+1)+1)+1=r(r(15)+1)+1=r(22+1)+1=r(23)+1=33+1=34
%e (nonprime).
%e n=6:
%e r(r(r(r(6)+1)+1)+1)+1=r(r(r(9+1)+1)+1)+1=r(r(r(10)+1)+1)+1=r(r(15+1)+1)+1=r(r(16)+1)+1=r(24+1)+1=r(25)+1
%e 35+1=36 (nonprime).
%e n=7:
%e r(r(r(r(7)+1)+1)+1)+1=r(r(r(10+1)+1)+1)+1=r(r(r(11)+1)+1)+1=r(r(16+1)+1)+1=r(r(17)+1)+1=r(25+1)+1=r(26)+1
%e 36+1=37=a(3).
%e n=8:
%e r(r(r(r(8)+1)+1)+1)+1=r(r(r(12+1)+1)+1)+1=r(r(r(13)+1)+1)+1=r(r(20+1)+1)+1=r(r(21)+1)+1=r(30+1)+1=r(31)+1=44+1=45
%e (nonprime).
%e n=9:
%e r(r(r(r(9)+1)+1)+1)+1=r(r(r(14+1)+1)+1)+1=r(r(r(15)+1)+1)+1=r(r(22+1)+1)+1=r(r(23)+1)+1=r(33+1)+1=r(34)+1
%e 48+1=49 (nonprime).
%e n=10:
%e r(r(r(r(10)+1)+1)+1)+1=r(r(r(15+1)+1)+1)+1=r(r(r(16)+1)+1)+1=r(r(24+1)+1)+1=r(r(25)+1)+1=r(35+1)+1=r(36)+1
%e 50+1=51(nonprime)
%e n=11:
%e r(r(r(r(11)+1)+1)+1)+1=r(r(r(16+1)+1)+1)+1=r(r(r(17)+1)+1)+1=r(r(25+1)+1)+1=r(r(26)+1)+1=r(36+1)+1=r(37)+1=51+1=52(nonprime),
%e etc.
%p A141468 := proc(n) option remember ; if n = 1 then 0; else for a from procname(n-1)+1 do if not isprime(a) then RETURN(a); fi; od: fi; end: rep := 4: for n from 1 to 400 do arep := n ; for i from 1 to rep do arep := A141468(arep)+1 ; od: if isprime(arep) then printf("%d,",arep) ; fi; od: # _R. J. Mathar_, Sep 05 2008
%Y Cf. A000040, A141468.
%K nonn
%O 1,1
%A _Juri-Stepan Gerasimov_, Aug 25 2008
%E 97 removed and extended by _R. J. Mathar_, Sep 05 2008