Is the Fermat primality test secure enough for very big numbers?

463 Views Asked by At

The random variable $X_m$ is the number of trials before

$n\notin\mathbb P\wedge n\mid 2^{n-1}-1$ where $n$ is an odd random integer $2^{m-1} < n < 2^m$.

Computer simulations makes me believe that $\text E[\log X_m]=\frac{m}{6}$ and that $\operatorname{Var}[\log X_m]<1$.

I'm looking for some kind of proof of this conjecture and would like to know how to compute or estimate $P(X_{1000}=1)$, given that the conjecture is true.

The context is: how secure is the Fermat primality test with base $2$ on numbers with $1000$ binary bits? Compared with the probability of hardware errors?


Well, perhaps the 10 in the logarithm doesn't flag for an exact $\frac{m}{6}$. The regression line is $\log N= 0.1666\cdot m+0.006$ which is interpreted as $N=10^{\frac{m}{6}}$ but might also be interpreted as $N=\pi^{\frac{m}{3}}$ within the marginals. $\overset{..}{\smile}$


enter image description here

$3251$ simulations total so far. Some lower experiments $(m=10)$ has been removed, since lower intervalls gives more irregular results. In some intervalls there are no discrepancies. Also long time running results from $m=40$ is included, so the equation of the line of regression has changed a little.


Diagram of the mean values of each m enter image description here

1

There are 1 best solutions below

2
On

Note that this Question deals with base 2 Fermat pseudoprimes rather than strong pseudoprimes as mentioned in one of the OP's earlier Questions.

Carl Pomerance ("On the Distribution of Pseudoprimes", 1981) bounds the count $P_2(x)$ of base 2 Fermat pseudoprimes less than $x$:

$$ \exp\left\{ (\log x)^{5/14} \right\} \le P_2(x) \le x \cdot L(x)^{-1/2} $$

where $$L(x) = \exp\left( \frac{(\log x) (\log \log \log x)}{\log \log x} \right) $$

Pomerance conjectures that $P_2(x) = x \cdot L(x)^{-1 + o(1)}$.

A nice exposition for these results is given by Matt Green ("The Distribution of Pseudoprimes", 2002).

The present Question asks about the probability that an odd number $X_{1000}$ chosen uniformly from:

$$ 2^{999} \lt X_{1000} \lt 2^{1000} $$

will be one of these base $2$ Fermat pseudoprimes (also known as Poulet numbers or even more obscurely, Sarrus numbers).

Now $L(2^{1000}) \approx exp\left(199.0170124\right) $ can be computed, and a corresponding upper bound and estimate of this probability will follow.