# On the Number of Witnesses in the Miller–Rabin Primality Test

^{*}

## Abstract

**:**

## 1. Introduction

**Definition**

**1.**

**Definition**

**2.**

**Definition**

**3.**

**Definition**

**4.**

## 2. Some History Remarks

## 3. Counting Number of Witnesses

**Theorem**

**1.**

**Proof.**

**Corollary**

**1.**

**Theorem**

**2.**

**Proof.**

- Since a is a primality witness for n then ${a}^{n-1}\equiv 1\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}n$ and ${a}^{n-1}\equiv 1\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}u$. Besides, $n-1=uv-1=\phi \left(u\right)v+(u-\phi (u\left)\right)v-1$, so$$1\equiv {a}^{n-1}\equiv {a}^{\phi \left(u\right)v+(u-\phi (u\left)\right)v-1}\equiv {a}^{(u-\phi (u\left)\right)v-1}\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}u,$$
- By symmetry.
- If $or{d}_{u}\left(a\right)$ is odd, then ${a}^{odd(n-1)}\equiv 1\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}n$ (otherwise, a satisfies the second clause of the MRT, and $or{d}_{u}\left(a\right)$ should be even). Then ${a}^{odd(n-1)}\equiv 1\phantom{\rule{0.277778em}{0ex}}mod\phantom{\rule{0.277778em}{0ex}}v$ and $or{d}_{v}\left(a\right)$ is odd.

**Example**

**1.**

**Theorem**

**3.**

**Proof.**

**Theorem**

**4.**

**Example**

**2.**

**Proof.**

**Corollary**

**2.**

**Proof.**

**Example**

**3.**

**Theorem**

**5.**

**Proof.**

## 4. Frequency Function

**Case**

**1.**

**Case**

**2.**

**Case**

**3.**

**Theorem**

**6.**

## 5. Numbers with Maximal Frequency of Witnesses

## 6. Conclusions

- We found exact formulas for the number of witnesses for composite n with different number of factors.
- We introduced the frequency function $Fr\left(n\right)$ characterizing the probability to find at one attempt a primality witness for a given n and found exact bounds for distribution of this function for semiprime integers n.
- Like as Damgard, Landrock, and Pomerance in [13], we studied an average values of $Fr\left(n\right)$ at intervals $[1;x]$ for semiprime integers $n=pq,\phantom{\rule{4pt}{0ex}}n\le x$, with fixed p and showed that it bounded above by ${p}^{2}logx/2(x-{p}^{2})$.Since such integers have maximal values of $F\left(n\right)$ among all composites, this opens a way in future investigations to find exact upper bounds for average values of frequency function among all k-bit odd integers for any k.
- Finally, we described possible forms of composites with maximal values of frequency function for products of k distinct primes at $k\ge 2$ and using computer calculations found their examples and their quantity at initial intervals of set of all naturals.

## Author Contributions

## Funding

## Conflicts of Interest

## References

- Miller Gary, L. Riemann’s Hypothesis and Tests for Primality. J. Comput. Syst. Sci.
**1976**, 13, 300–317. [Google Scholar] [CrossRef] [Green Version] - Rabin, M. Probabilistic algorithm for testing primality. J. Number Theory
**1980**, 12, 128–138. [Google Scholar] [CrossRef] [Green Version] - Crandall, R.; Pomerance, C. The Prime Numbers: A Computational Perspertive, 2nd ed.; Springer: Berlin, Germany, 2005; 604p. [Google Scholar]
- Alford, W.R.; Granville, A.; Pomerance, C. On the difficulty of finding reliable witnesses. In Algorithmic Number Theory; First Internat. Symp., ANTS-I; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 1994; p. 116. [Google Scholar]
- Pomerance, C.; Selfridge, J.L.; Wagstaff, S.S., Jr. The pseudoprimes to 25 · 10
^{9}. Math. Comput.**1980**, 35, 1003–1026. [Google Scholar] - Jaeschke, G. On Strong Pseudoprimes to Several Bases. Math. Comput.
**1993**, 61, 915–926. [Google Scholar] [CrossRef] - Arnault, F. Rabin-Miller primality test: composite numbers which pass it. J. Symb. Comput.
**1995**, 64, 355–361. [Google Scholar] [CrossRef] - Arnault, F. Constructing Carmichael numbers which are strong pseudoprimes to several bases. J. Symb. Comput.
**1995**, 20, 151–161. [Google Scholar] [CrossRef] [Green Version] - Zhang, Z. Finding strong pseudoprimes to several bases. Math. Comput.
**2001**, 70, 863–872. [Google Scholar] [CrossRef] [Green Version] - Jiang, J.; Deng, Y. Strong pseudoprimes to the first 9 prime bases. arXiv
**2012**, arXiv:1207.0063v1. [Google Scholar] - Sorenson, J.; Webster, J. Strong pseudoprimes to twelve prime bases. arXiv
**2015**, arXiv:1509.00864v1. [Google Scholar] [CrossRef] [Green Version] - Erdos, P.; Pomerance, C. On the number of false witnesses for a composite number. Math. Comput.
**1986**, 46, 259–279. [Google Scholar] [CrossRef] [Green Version] - Damgard, I.; Landrock, P.; Pomerance, C. Average case error estimates for the strong probable prime test. Math. Comput.
**1993**, 61, 177194. [Google Scholar] [CrossRef] [Green Version] - Ishmukhametov, S.; Mubarakov, B. On practical aspects of the Miller–Rabin primality test. Lobachevskii J. Math.
**2013**, 34, 304–312. [Google Scholar] [CrossRef]

1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

670 | 494 | 448 | 412 | 424 | 386 | 393 | 358 | 370 | 343 |

© 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Ishmukhametov, S.T.; Mubarakov, B.G.; Rubtsova, R.G.
On the Number of Witnesses in the Miller–Rabin Primality Test. *Symmetry* **2020**, *12*, 890.
https://doi.org/10.3390/sym12060890

**AMA Style**

Ishmukhametov ST, Mubarakov BG, Rubtsova RG.
On the Number of Witnesses in the Miller–Rabin Primality Test. *Symmetry*. 2020; 12(6):890.
https://doi.org/10.3390/sym12060890

**Chicago/Turabian Style**

Ishmukhametov, Shamil Talgatovich, Bulat Gazinurovich Mubarakov, and Ramilya Gakilevna Rubtsova.
2020. "On the Number of Witnesses in the Miller–Rabin Primality Test" *Symmetry* 12, no. 6: 890.
https://doi.org/10.3390/sym12060890