%I #8 Apr 03 2023 10:36:11
%S 101,103,107,109,167,211,257,307,347,401,409,431,463,487,503,509,523,
%T 541,563,601,607,617,643,653,701,709,743,761,809,853,907,1009,1013,
%U 1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103
%N Prime numbers in which the difference between the largest digit and the smallest digit is a digit in the same prime.
%H Chris Caldwell, <a href="https://t5k.org/lists/small/1000.txt">The First 1,000 Primes</a>
%e The difference between the largest digit (7) and the smallest digit (1) in the prime 167 is also in the same prime. The difference between the largest digit (9) and the smallest digit (0) in the prime 409 is also in the same prime. The difference between the largest digit (8) and the smallest digit (3) in the prime 853 is also in the same prime.
%t ss={};Do[id=IntegerDigits[p=Prime[n]];If[MemberQ[id,Max[id]-Min[id]],AppendTo[ss,p]],{n,2000}];ss (* _Zak Seidov_, Aug 24 2009 *)
%t fQ[n_] := Block[{id = Union@ IntegerDigits@ n}, MemberQ[id, id[[ -1]] - id[[1]] ]]; Select[ Prime@ Range@ 185, fQ@# &] (* _Robert G. Wilson v_, Aug 24 2009 *)
%Y Cf. A000040
%K base,nonn
%O 1,1
%A _Parthasarathy Nambi_, Aug 23 2009
%E Edited by _N. J. A. Sloane_, Aug 24 2009
%E Sequence corrected and extended by _Zak Seidov_ and _Robert G. Wilson v_, Aug 24 2009