A107845
Transposable-digit primes: Primes such that if any single pair of adjacent digits is transposed the result is a prime.
Original entry on oeis.org
2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 137, 179, 199, 277, 311, 331, 337, 373, 379, 397, 419, 491, 577, 613, 733, 811, 877, 911, 919, 977, 991, 1013, 1031, 1091, 1117, 1213, 1231, 1579, 1777, 1811, 1999, 2113, 2131, 2399, 2411, 2677, 2699, 2719
Offset: 1
137 is a term because it is prime and 173 and 317 are also prime.
173 is not a term because 713 is not prime (even though 173 and 137 are prime). {Hence none of 137,173,317,371,713,731 is a term of A003459.}
3119 is a term because it is prime and 1319 and 3191 are primes.
As 3119, 1193, 1931 and 9311 are all prime, 3119 is also a term of A068652.
Finally, although 1913 is also prime, neither 1139, 1391, 3911, 9113, nor 9131 is prime so 3119's twelve total permutations are not terms of A003459.
-
swap[lst_List, i_Integer] := Block[{lsu = lst}, ReplacePart[ lsu, {i -> lsu[[i + 1]], i + 1 -> lsu[[i]]}]]; fQ[n_] := Block[{id = IntegerDigits@ n, l = Floor@ Log10@ n}, And @@ Table[ PrimeQ@ FromDigits@ swap[id, j], {j, l}] == True]; Select[ Prime@ Range@ 500, fQ] (* Robert G. Wilson v, Nov 29 2014 *)
-
eva(n) = subst(Pol(n), x, 10)
switchdigits(v, pos) = my(vt=v[pos]); v[pos]=v[pos+1]; v[pos+1]=vt; v
is(n) = my(d=digits(n)); for(k=1, #d-1, if(!ispseudoprime(eva(switchdigits(d, k))), return(0))); 1
forprime(p=1, , if(is(p), print1(p, ", "))) \\ Felix Fröhlich, Sep 21 2019
A108387
Doubly-transmutable primes: primes such that simultaneously exchanging pairwise all occurrences of any two disjoint pairs of distinct digits results in a prime.
Original entry on oeis.org
113719, 131797, 139177, 139397, 193937, 313979, 317179, 317399, 331937, 371719, 739391, 779173, 793711, 793931, 797131, 917173, 971713, 971933, 979313, 997391, 1111793, 3333971, 7777139, 9999317, 13973731, 31791913, 79319197, 97137379
Offset: 1
a(0) = 113719 as this is the first prime having four distinct digits and such that all three simultaneous pairwise exchanges of all distinct digits as shown below 'transmutate' the original prime into other primes:
(1,3) and (7,9): 113719 ==> 331937 (prime),
(1,7) and (3,9): 113719 ==> 779173 (prime),
(1,9) and (3,7): 113719 ==> 997391 (prime).
-
N:= 100: # to get a(1) to a(N)
R:= NULL: count:= 0:
S[1] := [0=1,1=3,2=7,3=9]:
S[2] := [0=3,1=1,2=9,3=7]:
S[3] := [0=7,1=9,2=1,3=3]:
S[4] := [0=9,1=7,2=3,3=1]:
g:= L -> add(L[i]*10^(i-1),i=1..nops(L)):
for d from 6 while count < N do
for n from 4^d to 2*4^d-1 while count < N do
L:= convert(n,base,4)[1..-2];
if nops(convert(L,set)) < 4 then next fi;
if andmap(isprime,[seq(g(subs(S[i],L)),i=1..4)]) then
R:= R, g(subs(S[1],L)); count:= count+1;
fi
od od:
R; # Robert Israel, Jul 27 2020
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.
Original entry on oeis.org
13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 179, 191, 199, 313, 331, 337, 773, 911, 919, 1171, 1933, 3391, 7717, 9311, 11113, 11119, 11177, 11717, 11933, 33199, 33331, 77171, 77711, 77713, 79999, 97777, 99991, 113111, 131111, 131113, 131171, 131311
Offset: 1
179 is a term because it is prime and its three transmutations are all prime:
exchanging ('transmuting') 1 and 7: 179 ==> 719 (prime),
exchanging 1 and 9: 179 ==> 971 (prime) and
exchanging 7 and 9: 179 ==> 197 (prime).
(As 791 and 917 are not prime, 179 is not a term of A068652 or A003459 also.).
Similarly, 1317713 is transmutable:
exchanging all 1's and 3s: 1317713 ==> 3137731 (prime),
exchanging all 1's and 7s: 1317713 ==> 7371173 (prime) and
exchanging all 3s and 7s: 1317713 ==> 1713317 (prime).
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).
-
from gmpy2 import is_prime
from itertools import combinations, count, islice, product
def agen(): # generator of terms
for d in count(2):
for p in product("1379", repeat=d):
p, s = "".join(p), sorted(set(p))
if len(s) == 1: continue
if is_prime(t:=int(p)):
if all(is_prime(int(p.translate({ord(c):ord(d), ord(d):ord(c)}))) for c, d in combinations(s, 2)):
yield t
print(list(islice(agen(), 50))) # Michael S. Branicky, Dec 15 2023
A108389
Transmutable primes with four distinct digits.
Original entry on oeis.org
133999337137, 139779933779, 173139331177, 173399913979, 177793993177, 179993739971, 391331737931, 771319973999, 917377131371, 933971311913, 997331911711, 1191777377177, 9311933973733, 9979333919939, 19979113377173, 31997131171111, 37137197179931, 37337319113911
Offset: 1
a(0)=133999337137 is the smallest transmutable prime with four distinct digits (1,3,7,9):
exchanging all 1's and 3's: 133999337137 ==> 311999117317 (prime),
exchanging all 1's and 7's: 133999337137 ==> 733999331731 (prime),
exchanging all 1's and 9's: 133999337137 ==> 933111337937 (prime),
exchanging all 3's and 7's: 133999337137 ==> 177999773173 (prime),
exchanging all 3's and 9's: 133999337137 ==> 199333997197 (prime) and
exchanging all 7's and 9's: 133999337137 ==> 133777339139 (prime).
No smaller prime with four distinct digits transmutes into six other primes.
Cf.
A108386 (Primes p such that p's set of distinct digits is {1, 3, 7, 9}),
A108388 (transmutable primes),
A083983 (transmutable primes with two distinct digits),
A108387 (doubly-transmutable primes),
A006567 (reversible primes),
A002385 (palindromic primes),
A068652 (every cyclic permutation is prime),
A107845 (transposable-digit primes),
A003459 (absolute primes),
A057876 (droppable-digit primes).
A129338
Absolute primes, alternative definition: every permutation of digits is a prime and there are at least two different digits.
Original entry on oeis.org
13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 199, 311, 337, 373, 733, 919, 991
Offset: 1
See the main entry
A003459 for the usual definition.
-
Select[Prime[Range[5,170]],And@@PrimeQ[FromDigits/@Permutations[ IntegerDigits[#]]]&] (* Harvey P. Dale, Oct 03 2011 *)
A376500
Primes that contain at least one even digit and two different odd digits where any permutation of the odd digits leaving the even digits fixed produces a prime.
Original entry on oeis.org
107, 149, 167, 239, 293, 347, 389, 419, 491, 613, 619, 631, 691, 701, 709, 743, 761, 769, 907, 941, 967, 983, 1009, 1013, 1019, 1031, 1049, 1063, 1091, 1123, 1223, 1229, 1249, 1289, 1321, 1429, 1487, 1499, 1609, 1627, 1669, 1823, 1847, 2113, 2131, 2143, 2237, 2239, 2273, 2293, 2309, 2311, 2341
Offset: 1
1013 is a term since the permutations of the odd digits that leave the even digits fixed give 1031 and 3011, which are also prime.
-
filter:= proc(n) local L,oddi,eveni,xeven,i;
if not isprime(n) then return false fi;
L:= convert(n,base,10);
if member(5,L) then return false fi;
oddi,eveni:= selectremove(t -> L[t]::odd,[$1..nops(L)]);
if nops(eveni) = 0 or nops(convert(L[oddi],set))<2 then return false fi;
xeven:= add(10^(i-1)*L[i],i=eveni);
andmap(t -> isprime(xeven+add(10^(oddi[i]-1)*L[t[i]],i=1..nops(oddi))), combinat:-permute(oddi))
end proc:
select(filter, [seq(i,i=3..10000,2)]); # Robert Israel, Oct 23 2024
A376501
Primes that contain at least two different even digits where any permutation of the even digits leaving the odd digits fixed produces a prime. See comments for the treatment of 0.
Original entry on oeis.org
241, 281, 283, 401, 421, 461, 463, 467, 601, 607, 641, 643, 647, 683, 809, 821, 823, 863, 1021, 1049, 1061, 1069, 1201, 1249, 1283, 1409, 1429, 1487, 1601, 1609, 1823, 1847, 2011, 2027, 2039, 2161, 2207, 2347, 2389, 2411, 2417, 2441, 2459, 2473, 2503, 2543, 2617, 2657, 2671, 2677, 2699, 2707
Offset: 1
2027, 2207 are primes and 227 is prime with a leading 0 generated by permuting even digits in either 2027 or 2207. Hence 2027 and 2207 are in the sequence but 227 is not due to the leading 0.
6067, 6607 are primes but 667 generated by permuting even digits in either 6067 or 6607 is not prime, hence by name, neither number is in the sequence.
-
filter:= proc(n) local L,oddi,eveni,xodd,i;
if not isprime(n) then return false fi;
L:= convert(n,base,10);
oddi,eveni:= selectremove(t -> L[t]::odd,[$1..nops(L)]);
if nops(convert(L[eveni],set))<2 then return false fi;
xodd:= add(10^(i-1)*L[i],i=oddi);
andmap(t -> isprime(xodd+add(10^(eveni[i]-1)*L[t[i]],i=1..nops(eveni))), combinat:-permute(eveni))
end proc:
select(filter, [seq(i,i=3..10000,2)]); # Robert Israel, Oct 23 2024
A085300
a(n) is the least prime x such that when reversed it is a power of prime(n).
Original entry on oeis.org
2, 3, 5, 7, 11, 31, 71, 163, 18258901387, 90367894271, 13, 73, 1861, 344800741, 34351783286302805384336021, 940315563074788471, 1886172359328147919771, 14854831
Offset: 1
a(14)=344800741 means that 147008443=43^5=p(14)^5, where 5 is the smallest such exponent;
a(19) has 82 decimal digits and if reversed equals 39th power of p(19)=67.
A086051
Nontrivial numbers which are prime, contain no zero digits and yield another prime when their digits are sorted in ascending order.
Original entry on oeis.org
31, 71, 73, 97, 131, 173, 193, 197, 271, 293, 311, 317, 373, 397, 419, 439, 491, 547, 571, 593, 617, 647, 659, 673, 719, 727, 733, 739, 743, 751, 757, 761, 839, 919, 937, 941, 947, 953, 971, 983, 991, 1171, 1213, 1231, 1291, 1297, 1321, 1327, 1429, 1549
Offset: 1
a(1)=31 because an ascending sort of 31's digits yields 13 which is also prime. a(100)=3527 because an ascending sort of 3527's digits yields 2357 which is also prime.
-
sdaQ[n_]:=Module[{idn=IntegerDigits[n],srt},srt=Sort[idn];!MemberQ[ idn,0] &&idn!=srt&&PrimeQ[FromDigits[srt]]]; Select[Prime[Range[300]],sdaQ] (* Harvey P. Dale, Dec 14 2014 *)
A272106
Absolute primes in base 3: every permutation of digits in base 3 is a prime (only the smallest representatives of the permutation classes are shown).
Original entry on oeis.org
2, 5, 13, 1093, 797161, 3754733257489862401973357979128773, 6957596529882152968992225251835887181478451547013
Offset: 1
Comments