login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A073532 Number of n-digit primes with all digits distinct. 8

%I #25 Oct 29 2023 21:51:55

%S 4,20,97,510,2529,10239,33950,90510,145227,0,0,0,0,0,0,0,0,0,0,0,0,0,

%T 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

%N Number of n-digit primes with all digits distinct.

%C For any base b the number of distinct-digit primes is finite. For base 10, the maximal distinct-digit prime is 987654103; for any larger prime at least two digits coincide. The number of distinct-digit integers is also finite, see A073531.

%C No such primes exist with 10 or more decimal digits, so a(n) = 0 for n >= 10. - _Labos Elemer_, Oct 25 2004; _Robert G. Wilson v_, Jul 25 2008

%e a(3)=97 because there are 97 three-digit primes with distinct digits: 103, 107, 109, 127, 137, 139, 149, 157, 163, 167, 173, 179, 193, 197,239, 241, 251, 257, 263, 269, 271, 281, 283, 293,307, 317, 347, 349, 359, 367, 379, 389, 397, 401, 409, 419, 421, 431, 439, 457, 461, 463, 467, 479, 487, 491, 503, 509, 521, 523, 541, 547, 563, 569, 571, 587, 593, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 673, 683, 691, 701, 709, 719, 739, 743, 751, 761, 769, 809, 821, 823, 827, 829, 839, 853, 857, 859, 863, 907, 937, 941, 947, 953, 967, 971, 983.

%t lst = {}; Do[p = Prime@ n; If[ Union[Length /@ Split@ Sort@ IntegerDigits@ p] == {1}, AppendTo[lst, p]], {n, PrimePi[10^9]}]; Table[ Length@ Select[lst, 10^n < # < 10^(n + 1) &], {n, 0, 9}] (* _Robert G. Wilson v_, Jul 25 2008 *)

%o (Python)

%o from itertools import permutations

%o from sympy import isprime, primerange

%o def distinct_digs(n): s = str(n); return len(s) == len(set(s))

%o def a(n):

%o if n >= 10: return 0

%o return sum(isprime(int("".join(p))) for p in permutations("0123456789", n) if p[0] != '0')

%o print([a(n) for n in range(1, 31)]) # _Michael S. Branicky_, Apr 20 2021

%Y Cf. A073531, A006880, A006879, A098224-A098227, A140532.

%K base,nonn

%O 1,1

%A _Zak Seidov_, Aug 29 2002

%E Edited by _N. J. A. Sloane_, Aug 14 2007

%E Entries checked by _Robert G. Wilson v_, Jul 25 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 01:40 EDT 2024. Contains 371696 sequences. (Running on oeis4.)