A235154 Primes which have one or more occurrences of exactly two different digits.
13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, 449, 499, 557, 577, 599, 661, 677, 727, 733, 757, 773, 787, 797, 811
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..12000 (terms 651..3401 from Christopher M. Conrey, terms 1..650 from Colin Barker)
- David A. Corneth, PARI program
Programs
-
PARI
s=[]; forprime(n=10, 1000, if(#vecsort(eval(Vec(Str(n))),,8)==2, s=concat(s, n))); s
-
PARI
is(n)=isprime(n) && #Set(digits(n))==2 \\ Charles R Greathouse IV, Feb 23 2017
-
PARI
\\ See Corneth link
-
Python
from sympy import isprime from sympy.utilities.iterables import multiset_permutations from itertools import count, islice, combinations_with_replacement, product def agen(): for digits in count(2): s = set() for pair in product("0123456789", "1379"): if pair[0] == pair[1]: continue for c in combinations_with_replacement(pair, digits): if len(set(c)) < 2 or sum(int(ci) for ci in c)%3 == 0: continue for p in multiset_permutations(c): if p[0] == "0": continue t = int("".join(p)) if isprime(t): s.add(t) yield from sorted(s) print(list(islice(agen(), 100))) # Michael S. Branicky, Jan 23 2022
Comments