OFFSET
1,1
COMMENTS
Heuristically, both this sequence and its complement should have positive density within the primes. Empirically, n/pi(a(n)) approaches ~0.75 for large n. But is this sequence even infinite?
Dickson's conjecture implies it is infinite, e.g. it implies that there are infinitely many primes ending in 13 for which changing the last two digits to 31 produces a prime. - Robert Israel, Sep 04 2024
LINKS
Matthew House, Table of n, a(n) for n = 1..10000
EXAMPLE
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.
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]] &]
PROG
(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
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Matthew House, Sep 04 2024
STATUS
approved