%I #29 Nov 06 2023 14:10:13
%S 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,
%T 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,
%U 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
%N 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.
%C First occurrence of k, from 0 to 45: 5, 195, 87, 1, 18, 10, 8, 9, 7, 6, 29, 172, 28, 1275, 7666, 1279, ..., .
%H Robert Price, <a href="/A180560/b180560.txt">Table of n, a(n) for n = 1..2000</a>
%H <a href="/index/Pri#primes">Index to Primes</a>, Primes that become a different prime under some mapping.
%e 2 can become either 3, 5 or 7 under the proper mapping, therefore a(1)=3.
%e 11 cannot become any other prime regardless of the mapping, therefore a(5)=0.
%t 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}]
%o (Python)
%o from sympy import isprime, prime
%o def a(n):
%o s = str(prime(n))
%o 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))))
%o print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Oct 31 2023
%Y Cf. A175791, A180517 thru A180559, A175789, A180561.
%K base,nonn
%O 1,1
%A _Zak Seidov_ and _Robert G. Wilson v_, Sep 09 2010
%E a(101)-a(104) corrected by _Robert Price_, Oct 31 2023
|