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.

A235154 Primes which have one or more occurrences of exactly two different digits.

Original entry on oeis.org

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

Views

Author

Colin Barker, Jan 04 2014

Keywords

Comments

The first term having a repeated digit is 101.
a(3402) > 10^10.

Crossrefs

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