%I #29 Dec 13 2023 20:32:41
%S 2,3,5,7,13,17,19,23,29,37,47,59,67,79,89,127,137,139,149,157,167,179,
%T 239,257,269,347,349,359,367,379,389,457,467,479,569,1237,1249,1259,
%U 1279,1289,1367,1459,1489,1567,1579,1789,2347,2357,2389,2459,2467,2579
%N Primes with distinct digits in ascending order.
%H T. D. Noe, <a href="/A052015/b052015.txt">Table of n, a(n) for n = 1..100</a> (complete sequence)
%e Last term is a(100) = 23456789.
%t t={};Do[p=Prime[n];If[Select[Differences[IntegerDigits[p]],#<=0&]=={},AppendTo[t,p]],{n,380}];t (* _Jayanta Basu_, May 04 2013 *)
%t Select[Prime[Range[5000]],Min[Differences[IntegerDigits[#]]]>0&] (* _Harvey P. Dale_, Jun 20 2015 *)
%t Select[FromDigits@# &/@Subsets@Range@9,PrimeQ] (* _Hans Rudolf Widmer_, Apr 08 2023 *)
%o (PARI) A052015=vecextract( vecsort( vector( 511,i,isprime( t=eval( concat( vecextract(Vec("123456789"),i ))))*t),NULL,8),"^1") /* for old PARI versions replace,NULL,8),"^1" by ),"-100.." */ \\ _M. F. Hasler_, Jan 27 2009
%o (Python)
%o from sympy import isprime
%o from itertools import combinations
%o def agen(): # generator of terms
%o for d in range(1, 9):
%o for c in combinations("123456789", d):
%o if isprime(t:=int("".join(c))):
%o yield t
%o print(list(agen())) # _Michael S. Branicky_, Dec 13 2023
%Y Cf. A028864, A028867, A052014.
%K nonn,base,fini,full
%O 1,1
%A _Patrick De Geest_, Nov 15 1999
|