login
A387904
Numbers in which there exist two, distinct, non-overlapping prime substrings that can be swapped to form a prime number.
1
32, 35, 37, 73, 112, 113, 133, 137, 172, 173, 175, 197, 232, 235, 251, 253, 272, 275, 277, 292, 305, 311, 313, 317, 319, 322, 323, 325, 329, 331, 332, 335, 337, 343, 347, 359, 361, 362, 365, 367, 373, 377, 379, 382, 392, 395, 412, 415, 437, 473, 475, 521, 527, 532
OFFSET
1,1
COMMENTS
Leading zeros are disallowed in both substrings chosen for swapping.
No term is divisible by 3. - David A. Corneth, Oct 30 2025
Terms cannot end in 0, 4, 6 or 8; terms ending in 2 or 5 must swap 2 or 5, respectively. - Michael S. Branicky, Oct 30 2025
LINKS
EXAMPLE
The first term is 32: swapping the digits yields 23.
The first 3-digit term is 112: swapping 11 and 2 yields 211, a prime.
382 is a term as swapping distinct substrings 2 and 3 yields 283 which is prime. - David A. Corneth, Oct 30 2025
PROG
(Python)
from sympy import isprime
def ok(n):
s = str(n)
return any(isprime(int(s[:i]+s[j:j+m]+s[i+h:j]+s[i:i+h]+s[j+m:]))
for i in range(len(s)-1)
if s[i] != '0'
for j in range(i+1, len(s))
if s[j] != '0'
for h in range(1, j-i+1)
if isprime(int(s[i:i+h]))
for m in range(1, len(s)-j+1)
if s[j:j+m] != s[i:i+h] and isprime(int(s[j:j+m])))
print([k for k in range(500) if ok(k)]) # Michael S. Branicky, Oct 28 2025
CROSSREFS
Cf. A000040.
Sequence in context: A074287 A223589 A159889 * A345490 A095481 A095475
KEYWORD
nonn,base
AUTHOR
James S. DeArmon, Oct 10 2025
STATUS
approved