OFFSET
1,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
EXAMPLE
There are two composite numbers less than 7, namely, 4 and 6, and 2 is prime. Therefore 7 is a member of the sequence.
MAPLE
c:= proc(n) option remember; `if`(n<4, 0,
c(n-1)+`if`(isprime(n-1), 0, 1))
end:
a:= proc(n) option remember; local p;
p:= `if`(n=1, 1, a(n-1));
do p:= nextprime(p);
if isprime(c(p)) then break fi
od; p
end:
seq(a(n), n=1..100); # Alois P. Heinz, Jul 23 2015
MATHEMATICA
fQ[n_]:=PrimeQ[n-PrimePi[n]-1]; Select[Prime[Range@400], fQ[#]&] (* Ivan N. Ianakiev, Jul 12 2015 *)
PROG
(PARI) is_ok(n)=my(i, k=0); for(i=2, n-1, if(bigomega(i)>1, k++)); isprime(k)&&isprime(n);
first(m)=my(i=1, v=vector(m), k=0); while(i<=m, if(is_ok(k), v[i]=k; i++); k++); v; \\ Anders Hellström, Jul 29 2015
(PARI) listp(nn)=forprime(p=2, nn, if (isprime(p - primepi(p) - 1), print1(p, ", ")); ); \\ Michel Marcus, Aug 27 2016
(PARI) list(lim)=my(v=List(), n=1); forprime(p=2, lim, if(isprime(p - n++), listput(v, p))); Vec(v) \\ Charles R Greathouse IV, Aug 28 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Antonio Gimenez, Jul 11 2015
EXTENSIONS
a(16)-a(61) from Ivan N. Ianakiev, Jul 12 2015
STATUS
approved