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.
%I A108388 #9 Dec 15 2023 08:52:46 %S A108388 13,17,31,37,71,73,79,97,113,131,179,191,199,313,331,337,773,911,919, %T A108388 1171,1933,3391,7717,9311,11113,11119,11177,11717,11933,33199,33331, %U A108388 77171,77711,77713,79999,97777,99991,113111,131111,131113,131171,131311 %N A108388 Transmutable primes: Primes with distinct digits d_i, i=1,m (2<=m<=4) such that simultaneously exchanging all occurrences of any one pair (d_i,d_j), i<>j results in a prime. %C A108388 a(n) is a term iff a(n) is prime and binomial(m,2) 'transmutations' (see example) of a(n) are different primes. A083983 is the subsequence for m=2: one transmutation (The author of A083983, Amarnath Murthy, calls the result of such a digit-exchange a self-complement. {Because I didn't know until afterwards that this sequence was a generalization of A083983 and as this generalization always leaves some digits unchanged for m>2, I've chosen different terminology.}). A108389 ({1,3,7,9}) is the subsequence for m=4: six transmutations. Each a(n) corresponding to m=3 (depending upon its set of distinct digits) and having three transmutations is also a member of A108382 ({1,3,7}), A108383 ({1,3,9}), A108384 ({1,7,9}), or A108385 ({3,7,9}). The condition m>=2 only eliminates the repunit (A004022) and single-digit primes. The condition m<=4 is not a restriction because if there were more distinct digits, they would include even digits or the digit 5, in either case transmuting into a composite number. Some terms such as 1933 are reversible primes ("Emirps": A006567) and the reverse is also transmutable. The transmutable prime 3391933 has three distinct digits and is also a palindromic prime (A002385). The smallest transmutable prime having four distinct digits is A108389(0) = 133999337137 (12 digits). %H A108388 Michael S. Branicky, <a href="/A108388/b108388.txt">Table of n, a(n) for n = 1..10000</a> %e A108388 179 is a term because it is prime and its three transmutations are all prime: %e A108388 exchanging ('transmuting') 1 and 7: 179 ==> 719 (prime), %e A108388 exchanging 1 and 9: 179 ==> 971 (prime) and %e A108388 exchanging 7 and 9: 179 ==> 197 (prime). %e A108388 (As 791 and 917 are not prime, 179 is not a term of A068652 or A003459 also.). %e A108388 Similarly, 1317713 is transmutable: %e A108388 exchanging all 1's and 3s: 1317713 ==> 3137731 (prime), %e A108388 exchanging all 1's and 7s: 1317713 ==> 7371173 (prime) and %e A108388 exchanging all 3s and 7s: 1317713 ==> 1713317 (prime). %o A108388 (Python) %o A108388 from gmpy2 import is_prime %o A108388 from itertools import combinations, count, islice, product %o A108388 def agen(): # generator of terms %o A108388 for d in count(2): %o A108388 for p in product("1379", repeat=d): %o A108388 p, s = "".join(p), sorted(set(p)) %o A108388 if len(s) == 1: continue %o A108388 if is_prime(t:=int(p)): %o A108388 if all(is_prime(int(p.translate({ord(c):ord(d), ord(d):ord(c)}))) for c, d in combinations(s, 2)): %o A108388 yield t %o A108388 print(list(islice(agen(), 50))) # _Michael S. Branicky_, Dec 15 2023 %Y A108388 Cf. A108382, A108383, A108384, A108385, A108386, A108389 (transmutable primes with four distinct digits), A083983 (transmutable primes with two distinct digits), A108387 (doubly-transmutable primes), A006567 (reversible primes), A002385 (palindromic primes), A068652 (every cyclic permutation is prime), A003459 (absolute primes). %K A108388 base,nonn %O A108388 1,1 %A A108388 _Rick L. Shepherd_, Jun 02 2005