This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A052902 #12 Jul 03 2025 18:32:35 %S A052902 0,0,0,0,0,18,54,0,0,0,18,36,0,0,0,0,0,0,0,54,36,18,0,0,18,90,72,36, %T A052902 90,18,144,18,36,54,270,0,414,450,450,36,18,630,720,54,18,720,0,0,0,0, %U A052902 0,54,180,270,0,0,0,144,450,540,540,54,234,180,18,144,18,36,396,90,0,234,306 %N A052902 Take n-th prime p, let P = all primes that can be obtained by permuting the digits of p and possibly omitting zeros; a(n) = |p-q| where q in P is the closest to p but different from p (a(n)=0 if no such q exists). %H A052902 Harvey P. Dale, <a href="/A052902/b052902.txt">Table of n, a(n) for n = 1..1000</a> %e A052902 a(6)=18 since 6th prime is 13 and 31-13=18. a(25)=90 since 23rd prime is 101 and 101-11=90. %t A052902 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 *) %Y A052902 Cf. A052998, A052999, A053544, A052495. %K A052902 base,easy,nonn %O A052902 1,6 %A A052902 _N. J. A. Sloane_, Mar 16 2000 %E A052902 More terms from _Asher Auel_, May 12 2000