Do $n=2m+1$ and $\big(2^m\bmod(m\cdot n)\big)\in\{n+1,3n-1\}$ imply $n$ prime?

577 Views Asked by At

Do $n=2m+1$ and $\big(2^m\bmod(m\cdot n)\big)\in\{n+1,3n-1\}$ imply $n$ prime?

Equivalently, for $n=2m+1$, do $2^m\equiv\pm1\pmod n$ and $2^m\equiv2\pmod m$ imply $n$ prime?
Note: equivalence follows from the Chinese Remainder Theorem for $m>2$, and examination otherwise. $2^m\equiv\pm1\pmod n$ is an Euler test for $n$.

What if we add the stronger requirements that $2^{(m-1)/2}\equiv\pm1\pmod m$ ? That $m$ pass the strong pseudoprime test to base 2?


The $n$ with $m$ prime that pass the test include all the safe primes (OEIS A005385) above $5$. The corresponding $m$ are Sophie Germain primes (OEIS A005384).
Proof: safe primes $p=2q+1$ match $2^q\equiv\pm1\pmod p$ by Euler's criterion, and match $2^q\equiv2\pmod q$ by Fermat's little theorem.

I fail to prove that conversely, the $n=2m+1$ with $m$ prime that pass the test include nothing but the safe primes.

There are a few other $n$ that pass the test, dubbed pseudo-safe-primes, A300193; terms less than $2^{42}$ b300193; first ones:

683, 1123, 1291, 4931, 16963, 25603, 70667, 110491, 121403, 145771, 166667, 301703, 424843, 529547, 579883, 696323, 715523, 854467, 904103, 1112339, 1175723, 1234187, 1306667, 1444523, 2146043, 2651687, 2796203, 2882183, 3069083, 3216931, 4284283, 4325443, 4577323, 5493179, 5764531, 9949943, 

The smallest even $m$ are for $n=252\,435\,584\,573$, $1\,200\,060\,997\,853$, $2\,497\,199\,739\,653$, $453\,074\,558\,824\,253$... which are prime. Any such even $m$ is an even pseudoprime (OEIS A006935).

All odd $m$ are pseudoprimes (OEIS A001567) passing a Fermat test, with the corresponding $n$ passing a strong pseudoprime test.

1

There are 1 best solutions below

0
On

After Peter Košinár's answer/comment, it is settled that the answer to the title's question is no. And that even the stronger requirements: $n=2m+1$, $2^m\equiv\pm1\pmod n$, and $2^{(m-1)/2}\equiv\pm1\pmod m\ $ do not imply $n$ prime. Many of the $m=(4^p-1)/3$ with $p$ prime turn out to be counterexamples, including $p$ among

23, 29, 41, 53, 89, 113, 131, 179, 191, 233, 239, 251, 281, 293, 359, 419, 431, 443, 491, 509, 593, 641, 653, 659, 683, 719, 743, 761, 809, 911, 953, 1013, 1019, 1031, 1049, 1103, 1223, 1229, 1289, 1409, 1439, 1451, 1481, 1499, 1511, 1559, 1583, 1601, 1733, 1811, 1889, 1901, 1931, 1973, 2003, 

It holds that if $n=2m+1$ with $m$ prime and $2^m\equiv\pm1\pmod n$, then $n$ is prime. That's proven by Fedor Petrov here, with details there.


Question remaining open: do $n=2m+1$, $n$ and $m$ passing the strong pseudoprime test to base 2 imply $n$ prime?