OFFSET
1,6
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(6)=18 since 6th prime is 13 and 31-13=18. a(25)=90 since 23rd prime is 101 and 101-11=90.
MATHEMATICA
pdp[n_]:=Module[{p1=FromDigits/@Permutations[IntegerDigits[n]], p2=FromDigits/@ Permutations[ Select[IntegerDigits[n], #>0&]], p3}, p3=Select[ Union[ Join[ p1, p2]], PrimeQ[#]&&#!=n&]; If[Length[p3]==0, 0, First[Abs[Nearest[p3, n]-n]]]]; Table[pdp[n], {n, Prime[Range[80]]}] (* Harvey P. Dale, Nov 11 2016 *)
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
N. J. A. Sloane, Mar 16 2000
EXTENSIONS
More terms from Asher Auel, May 12, 2000
STATUS
approved