%I #29 Apr 21 2021 04:27:05
%S 4,20,83,395,1610,5045,12850,23082,0,0,0,0,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
%N Number of primes with n distinct decimal digits, none of which are 0.
%C a(9) is zero because 1+2+...+9 = 45 which is divisible by 3, making any number with 9 distinct digits also divisible by 3. - _Wei Zhou_, Oct 02 2011
%C The maximal distinct-digit prime without 0's is 98765431. Thus, a(n) = 0 for n >= 9. - _Michael S. Branicky_, Apr 20 2021
%e a(1) = #{2,3,5,7} = 4.
%e a(2) = #{13,17,19,23,...,97} = 20. Note that the prime 11 is omitted because its decimal digits are not distinct.
%t Length /@ Table[Select[FromDigits /@ Permutations[Range@9, {i}], PrimeQ], {i,9}] (* _Wei Zhou_, Oct 02 2011 *)
%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 >= 9: return 0
%o return sum(isprime(int("".join(p))) for p in permutations("123456789", n))
%o print([a(n) for n in range(1, 30)]) # _Michael S. Branicky_, Apr 20 2021
%Y Cf. A112371, A073532.
%K nonn,base
%O 1,1
%A Norman Morton (mathtutorer(AT)yahoo.com), Jul 03 2008
%E Corrected by _Charles R Greathouse IV_, Aug 02 2010
|