cp's OEIS Frontend

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.

A140532 Number of primes with n distinct decimal digits, none of which are 0.

Original entry on oeis.org

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, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Norman Morton (mathtutorer(AT)yahoo.com), Jul 03 2008

Keywords

Comments

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
The maximal distinct-digit prime without 0's is 98765431. Thus, a(n) = 0 for n >= 9. - Michael S. Branicky, Apr 20 2021

Examples

			a(1) = #{2,3,5,7} = 4.
a(2) = #{13,17,19,23,...,97} = 20. Note that the prime 11 is omitted because its decimal digits are not distinct.
		

Crossrefs

Programs

  • Mathematica
    Length /@ Table[Select[FromDigits /@ Permutations[Range@9, {i}], PrimeQ], {i,9}] (* Wei Zhou, Oct 02 2011 *)
  • Python
    from itertools import permutations
    from sympy import isprime, primerange
    def distinct_digs(n): s = str(n); return len(s) == len(set(s))
    def a(n):
      if n >= 9: return 0
      return sum(isprime(int("".join(p))) for p in permutations("123456789", n))
    print([a(n) for n in range(1, 30)]) # Michael S. Branicky, Apr 20 2021

Extensions

Corrected by Charles R Greathouse IV, Aug 02 2010