5

(All dots here means concatenation.)

Let $s= ab$ be a semiprime number, then I call s a "prime" semiprime if all these following conditions are satisfied:

  1. The reversal of $s$ is a prime
  2. The concatenation of $a$ and $b$ in any order(i.e. $a{.}b$ and $b{.}a$) are primes.
  3. And these following six are all also primes $s{.}a{.}b$, $s{.}b{.}a$, $a{.}s{.}b$, $b{.}s{.}a$, $a{.}b{.}s$, $b{.}a{.}s$.

I've search numbers up to $10000$, but I couldn't find a single semiprime that satisfies all these conditions, so what is the smallest "prime" semiprime?

mezzoctane
  • 2,241
  • 2
  • 8
  • 21
  • If the problem is weakened by omitting condition 1 (about the reversal), the semiprime $289332850783 = 772001 \cdot 374783$ satisfies the rest. Let $a = 772001$, $b = 374783$, $s = a b = 289332850783$, then all of $a$, $b$, $a . b$, $b . a$, $s . a . b$, $s . b . a$, $a . s . b$, $b . s . a$, $a . b . s$, $b . a . s$ are primes. Are there more solutions of this weaker version? Are there infinitely many? – mezzoctane Sep 30 '25 at 10:24

3 Answers3

9

There are likely to be infinitely many, and you're not likely to find any.

As a rough estimate, the reversal of $s$ and the concatenations of $a$ and $b$ are of the order of $s$, and the concatenations of $s$, $a$ and $b$ are of the order of $s^2$. So you want $s$ to be a semiprime (density $\log\log s\,/\,(2\log s)$), three numbers of the order of $s$ to be primes (density $1/\log s$) and six numbers of the order of $s^2$ to be primes (density $1/\log s^2=1/(2\log s)$). The density of such numbers is roughly

$$ \frac{\log\log s}{2\log s}\left(\frac1{\log s}\right)^3\left(\frac1{2\log s}\right)^6=\frac{\log\log s}{128(\log s)^{10}}\;. $$

The integral of that density from where you ended your search, $10^4$, up to a reasonable search limit of $10^{13}$ is, according to Wolfram|Alpha, about $7\cdot10^{-4}$. Nevertheless, the integral over this density to infinity diverges, so if you keep looking long enough, you should eventually find one. Expect about two of them with $18$ digits.

joriki
  • 243,700
  • 1
    There are several solutions with $\le 14$ digits (137800963117, 11591369917021, 16437655709779, 15304844598349, 18375907382059, 1101997269847): https://math.stackexchange.com/a/5099467/1009203 – mezzoctane Oct 02 '25 at 03:35
6

I agree with joriki's basic approach, but I think the details are different.

Let's first consider the possibilities mod 6 for the primes $a \le b.$

  1. $a=2$. Clearly, b.a will be composite, so this doesn't work. Hence $a>2.$
  2. $a=3$. Then $s$ is a multiple of 3, and its reversal will be too. Hence $a>3.$
  3. $a\equiv1\pmod3, b\equiv1\pmod3$. Then a.b.s is divisible by 3. This doesn't work.
  4. $a\equiv1\pmod3, b\equiv2\pmod3$. Then a.b is divisible by 3. This doesn't work. Hence $a\equiv2\pmod3.$
  5. $a\equiv2\pmod3, b\equiv1\pmod3$. Then a.b is divisible by 3. This doesn't work. Hence $a\equiv b\equiv2\pmod3.$

Of course, if one prime is 5 then any of the concatenations ending with it will be divisible by 5, so that's out. If the primes are the same, their concatenation will be divisible by the prime.

In summary, we have $11\le a < b$ and $a\equiv b\equiv5\pmod6.$

Up to a limit $\ell,$ there are roughly $\ell\log\log\ell/(4\log\ell)$ such numbers. You're requiring 9 prime tests, of which 8 are guaranteed to be coprime to 6 and the remaining one is coprime to 3. The chance that a number around $x$ coprime to 3 is prime is about $3/2\log x$ and the chance that a number around $x$ coprime to 6 is prime is about $3/\log x$, so the chance that all 9 tests pass is roughly $$ \left(\frac{3}{\log x}\right)^8 \left(\frac{3}{2\log x}\right) =\frac{19683}{2\log^9x} $$ for an expected number of occurrences around $$ \frac{19683\,\ell\log\log\ell}{8\log^{10}\ell} $$

which gives an expectation of 0.51 at $10^9$, 1.84 at $10^{10}$, and 7.32 at $10^{11}.$ In a simple Poisson model these work out to probabilities of 40%, 84%, and 99.9%. So we have a good way to compare my heuristic with joriki's: if there is an example below $10^{13}$ his heuristic is very likely wrong, and if there isn't, mine is very likely wrong.

I will search for small solutions using this code (PARI/GP):

glue(a,b)=10^#Str(b)*a+b
rev(n)=fromdigits(Vecrev(digits(n)))
process(p,q,s=p*q)=my(v=apply(isprime,[glue(p,q),glue(q,p),rev(s)])); print(s" = "p"*"q": ",v); if(vecsum(v)==3, error("Found: ",s))
find(lim)=forprimestep(p=17,lim\11,6, forprimestep(q=11,min(p-6,lim\p),6, my(s=p*q,pq=glue(p,q),qp=glue(q,p)); if(isprime(glue(s,pq)) && isprime(glue(s,qp)) && isprime(glue(pq,s)) && isprime(glue(qp,s)) && isprime(glue(glue(p,s),q)) && isprime(glue(glue(q,s),p)), process(p,q))))
find(10^10)

A search to $10^{10}$ doesn't seem too hard, but it's not that likely to succeed. I'll start here, and move to $10^{11}$ if that seems feasible. Maybe with a bit of parallelism $10^{12}$ is doable, if needed; I hope to avoid going as far as $10^{13}$.

Charles
  • 33,217
3

The question asks for pairs of prime numbers $ \left(a,b\right) $ such that the base-10 reversal of $ s = a b $ is prime and all of concatenations $a{.}b$, $b{.}a$, $s{.}a{.}b$, $s{.}b{.}a$, $a{.}s{.}b$, $b{.}s{.}a$, $a{.}b{.}s$, $b{.}a{.}s$ are primes.

Solutions

I believe $137800963117=42299\cdot 3257783$ is the smallest solution (a separate search did not find any smaller semiprimes). See also related question "Find the smallest semiprime satisfying a bunch of conditions" at Code Review Stack Exchange.

My script found the following solutions with $ \max\{a,b\} \le 30\;000\;000 $:

  • $ 3257783 \cdot 42299 = 137800963117 $ is semiprime, reversal $ 711369008731 $ is prime
  • $ 3843467 \cdot 3015863 = 11591369917021 $ is semiprime, reversal $ 12071996319511 $ is prime
  • $ 5985341 \cdot 2746319 = 16437655709779 $ is semiprime, reversal $ 97790755673461 $ is prime
  • $ 6130469 \cdot 2496521 = 15304844598349 $ is semiprime, reversal $ 94389544840351 $ is prime
  • $ 6569579 \cdot 2797121 = 18375907382059 $ is semiprime, reversal $ 95028370957381 $ is prime
  • $ 6687323 \cdot 164789 = 1101997269847 $ is semiprime, reversal $ 7489627991011 $ is prime
  • $ 8842871 \cdot 1368737 = 12103564723927 $ is semiprime, reversal $ 72932746530121 $ is prime
  • $ 13637501 \cdot 5480843 = 74745001893343 $ is semiprime, reversal $ 34339810054747 $ is prime
  • $ 14955683 \cdot 7581533 = 113387004202039 $ is semiprime, reversal $ 930202400783311 $ is prime
  • $ 16685549 \cdot 5792747 = 96655163913103 $ is semiprime, reversal $ 30131936155669 $ is prime
  • $ 18240977 \cdot 6910073 = 126046482661321 $ is semiprime, reversal $ 123166284640621 $ is prime
  • $ 20420681 \cdot 346217 = 7069986913777 $ is semiprime, reversal $ 7773196899607 $ is prime
  • $ 21190703 \cdot 62099 = 1315921465597 $ is semiprime, reversal $ 7955641295131 $ is prime
  • $ 21477689 \cdot 6328109 = 135913157060101 $ is semiprime, reversal $ 101060751319531 $ is prime
  • $ 21694709 \cdot 5878637 = 127535319031633 $ is semiprime, reversal $ 336130913535721 $ is prime
  • $ 22174721 \cdot 5140901 = 113998045363621 $ is semiprime, reversal $ 126363540899311 $ is prime
  • $ 22291589 \cdot 8821991 = 196656197533699 $ is semiprime, reversal $ 996335791656691 $ is prime
  • $ 26124419 \cdot 4347659 = 113580065385121 $ is semiprime, reversal $ 121583560085311 $ is prime
  • $ 27804473 \cdot 5409137 = 150398203669801 $ is semiprime, reversal $ 108966302893051 $ is prime
  • $ 29542193 \cdot 4404677 = 130123818036661 $ is semiprime, reversal $ 166630818321031 $ is prime

Weakened version

(from comments)

If the problem is weakened by omitting "1. The reversal of $s$ is a prime" then there are many pairs $ \left(a,b\right) $ satisfying the rest. The first several examples:

  • semiprime $ 289332850783 = 772001 \cdot 374783 $, reversal $ 387058233982 = 2 \cdot 7 \cdot 8111 \cdot 3408583 $
  • semiprime $ 516976985713 = 888443 \cdot 581891 $, reversal $ 317589679615 = 5 \cdot 13 \cdot 4885995071 $
  • semiprime $ 185227997257 = 917729 \cdot 201833 $, reversal $ 752799722581 = 491 \cdot 1559 \cdot 983449 $
  • semiprime $ 1302834261241 = 1176983 \cdot 1106927 $, reversal $ 1421624382031 = 7 \cdot 59 \cdot 101 \cdot 34081087 $
  • semiprime $ 2598217316581 = 1658051 \cdot 1567031 $, reversal $ 1856137128952 = 2^3 \cdot 418321 \cdot 554639 $
mezzoctane
  • 2,241
  • 2
  • 8
  • 21