A375965 Primes which can be turned into a different prime by exchanging two consecutive digits.
13, 17, 31, 37, 71, 73, 79, 97, 101, 103, 107, 109, 113, 131, 137, 139, 149, 163, 167, 173, 179, 181, 191, 193, 197, 199, 239, 241, 251, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 349, 373, 379, 389, 397, 401, 419, 421, 439, 457, 461, 463, 467, 491, 503
Offset: 1
Examples
2, 3, 5, and 7 are excluded, since they have no two digits to exchange. 11 is excluded, since it yields only itself. 13 and 17 are included, since they yield the primes 31 and 71. 19, 23, and 29 are excluded, since they yield the composite numbers 91, 32, and 92.
Links
- Matthew House, Table of n, a(n) for n = 1..10000
Crossrefs
Subsequence of A225035.
Programs
-
Maple
filter:= proc(n) local L,d,i; if not isprime(n) then return false fi; L:= convert(n,base,10); d:= nops(L); for i from 1 to d-1 do if L[i] <> L[i+1] and isprime(n + (L[i]-L[i+1])*(10^i-10^(i-1))) then return true fi od; false end proc: select(filter, [seq(i,i=11 .. 1---,2)]); # Robert Israel, Sep 04 2024
-
Mathematica
Select[Prime[Range[100]], With[{digits = IntegerDigits[#]}, AnyTrue[Complement[FromDigits[Permute[digits, Cycles[{{#, # + 1}}]]] & /@ Range[Length[digits] - 1], {#}], PrimeQ]] &]
-
Python
from sympy import isprime def ok(n): if not isprime(n): return False s = str(n) for i in range(len(s)-1): t = int(s[:i]+s[i+1]+s[i]+s[i+2:]) if t != n and isprime(t): return True return False print([k for k in range(504) if ok(k)]) # Michael S. Branicky, Sep 04 2024
Comments