OFFSET
1,2
EXAMPLE
n=10: p(10)=29, c(10)=18, c(10)-p(10)=11, so 10=a(7) is here.
MATHEMATICA
f[ n_Integer ] := Block[ {k = n + PrimePi[ n ] + 1}, While[ k - PrimePi[ k ] - 1 != n, k++ ]; k ]; Select[ Range[ 500 ], PrimeQ[ Prime[ # ] - f[ # ] ] & ]
Module[{nn=2000, pr, cm, len, th}, pr=Prime[Range[PrimePi[nn]]]; cm=Select[ Range[ nn], CompositeQ]; len=Min[Length[pr], Length[cm]]; th=Thread[{Take[ pr, len], Take[ cm, len]}]; Position[th, _?(PrimeQ[Abs[#[[1]]-#[[2]]]]&)]]// Quiet//Flatten (* Harvey P. Dale, Jun 29 2020 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Robert G. Wilson v, Mar 22 2001
STATUS
approved