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.

A180560 The number of times the n-th prime, p, can become a different prime under any mapping of some single decimal digit <=> with some other single decimal digit.

Original entry on oeis.org

3, 3, 3, 3, 0, 9, 8, 6, 7, 5, 5, 7, 5, 8, 7, 7, 5, 4, 6, 6, 9, 7, 7, 5, 6, 4, 7, 12, 10, 6, 6, 5, 10, 9, 6, 6, 9, 9, 12, 7, 10, 6, 6, 7, 9, 3, 6, 7, 7, 3, 4, 6, 8, 6, 4, 7, 4, 6, 6, 5, 7, 5, 8, 4, 5, 7, 5, 7, 10, 6, 5, 7, 8, 3, 8, 5, 6, 8, 8, 8, 8, 7, 7, 3, 9, 6, 2, 6, 9, 7, 9, 6, 3, 7, 3, 6, 7, 6, 6, 7, 7, 5, 9, 5
Offset: 1

Views

Author

Zak Seidov and Robert G. Wilson v, Sep 09 2010

Keywords

Comments

First occurrence of k, from 0 to 45: 5, 195, 87, 1, 18, 10, 8, 9, 7, 6, 29, 172, 28, 1275, 7666, 1279, ..., .

Examples

			2 can become either 3, 5 or 7 under the proper mapping, therefore a(1)=3.
11 cannot become any other prime regardless of the mapping, therefore a(5)=0.
		

Crossrefs

Programs

  • Mathematica
    fQ[n_] := Block[{id = IntegerDigits@n}, (MemberQ[id, s[[1]]] || MemberQ[id, s[[2]]]) && PrimeQ[ FromDigits[id /. {s[[1]] -> s[[2]], s[[2]] -> s[[1]] }] ]]; t = Sort@ Flatten@ Table[s = {j, k}; Select[ Prime@ Range@ 100, fQ], {j, 0, 8}, {k, j + 1, 9}]; Table[ Length@ Position[t, Prime@ n], {n, 100}]
  • Python
    from sympy import isprime, prime
    def a(n):
        s = str(prime(n))
        return len(set(t for t in (s.translate({ord(c):ord(d), ord(d):ord(c)}) for c in set(s) for d in "0123456789" if d!=c) if isprime(int(t))))
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Oct 31 2023

Extensions

a(101)-a(104) corrected by Robert Price, Oct 31 2023