OFFSET
1,1
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, ..., .
LINKS
Robert Price, Table of n, a(n) for n = 1..2000
Index to Primes, Primes that become a different prime under some mapping.
EXAMPLE
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.
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}]
PROG
(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
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Zak Seidov and Robert G. Wilson v, Sep 09 2010
EXTENSIONS
a(101)-a(104) corrected by Robert Price, Oct 31 2023
STATUS
approved