DOI QR코드

DOI QR Code

A Step-by-Step Primality Test

단계적 소수 판별법

  • Lee, Sang-Un (Dept. of Multimedia Eng., Gangneung-Wonju National University)
  • 이상운 (강릉원주대학교 과학기술대학 멀티미디어공학과)
  • Received : 2013.01.03
  • Accepted : 2013.06.14
  • Published : 2013.06.30

Abstract

Miller-Rabin method is the most prevalently used primality test. However, this method mistakenly reports a Carmichael number or semi-prime number as prime (strong lier) although they are composite numbers. To eradicate this problem, it selects k number of m, whose value satisfies the following : m=[2,n-1], (m,n)=1. The Miller-Rabin method determines that a given number is prime, given that after the computation of $n-1=2^sd$, $0{\leq}r{\leq}s-1$, the outcome satisfies $m^d{\equiv}1$(mod n) or $m^{2^rd}{\equiv}-1$(mod n). This paper proposes a step-by-step primality testing algorithm that restricts m=2, hence achieving 98.8% probability. The proposed method, as a first step, rejects composite numbers that do not satisfy the equation, $n=6k{\pm}1$, $n_1{\neq}5$. Next, it determines prime by computing $2^{2^{s-1}d}{\equiv}{\beta}_{s-1}$(mod n) and $2^d{\equiv}{\beta}_0$(mod n). In the third step, it tests ${\beta}_r{\equiv}-1$ in the range of $1{\leq}r{\leq}s-2$ for ${\beta}_0$ > 1. In the case of ${\beta}_0$ = 1, it retests m=3,5,7,11,13,17 sequentially. When applied to n=[101,1000], the proposed algorithm determined 96.55% of prime in the initial stage. The remaining 3% was performed for ${\beta}_0$ >1 and 0.55% for ${\beta}_0$ = 1.

대표적인 소수판별법으로 밀러-라빈 방법이 적용되고 있다. 밀러-라빈 판별법은 카마이클 수 또는 반소수가 합성수임에도 불구하고 소수로 잘못 판별하는 단점이 있어 m=[2,n-1], (m,n)=1인 m을 k개 선택하여 소수 여부를 판별한다. 밀러-라빈 방법은 $n-1=2^sd$, $0{\leq}r{\leq}s-1$에 대해 $m^d{\equiv}1$(mod n) 또는 $m^{2^rd}{\equiv}-1$(mod n)로 소수를 판별한다. 본 논문은 m=2로 한정시켜 98.9%를 판별할 수 있는 알고리즘을 제안한다. 제안된 방법은 $n=6k{\pm}1$, $n_1{\neq}5$로 1차로 합성수 여부를 판별한다. 2차에서는 $2^{2^{s-1}d}{\equiv}{\beta}_{s-1}$(mod n)과 $2^d{\equiv}{\beta}_0$(mod n)로 판별하였으며, 3차에서는 ${\beta}_0$ >1이면 $1{\leq}r{\leq}s-2$에서 ${\beta}_r{\equiv}-1$ 존재 여부로, ${\beta}_0=1$이면 m=3,5,7,11,13,17을 순서대로 적용하였다. 제안된 알고리즘을 n=[101,1000]에 적용한 결과 ${\beta}_0$ >1은 26개로 3.0%, ${\beta}_0$ = 1은 0.55%만 수행되었으며, 96.55%는 초기에 판별할 수 있었다.

Keywords

References

  1. D. Zagier, "Newman's Short Proof of the Prime Number Theorem," American. Mathematical. Monthly, Vol. 104, No. 8, pp. 705-708, 1997. https://doi.org/10.2307/2975232
  2. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein, "Introduction to Algorithms," 2nd Ed., MIT Press and McGraw-Hill. pp. 887-896, 2001.
  3. R. D. Carmichael, "On composite numbers which satisfy the Fermat congruence $\alpha^{P-1}{\equiv}1 $ mod P ," American Mathematical Monthly, Vol. 19, No. 2, pp. 22-27, 1912. https://doi.org/10.2307/2972687
  4. M. E. O'Neill, "The Genuine Sieve of Eratosthenes," Journal of Functional Programming, Cambridge University Press, 2008.
  5. P. Ribenboim, "The New Book of Prime Number Records (3rd ed.)," New York: Springer-Verlag, 1995.
  6. M. O. Rabin, "Probabilistic algorithm for testing primality," Journal of Number Theory, Vol. 12, No. 1, pp. 128-138, 1980. https://doi.org/10.1016/0022-314X(80)90084-0
  7. C. Pomerance, J. L. Selfridge, and S. S. Wagstaff, "The Pseudoprimes to 25.109", Mathematics of Computation, Vol.35, No. 151, pp. 1003-1026, 1980.
  8. G. Jaeschke, "On strong pseudoprimes to several bases," Mathematics of Computation, Vol. 61, No. 204, pp. 915-926, 1993. https://doi.org/10.1090/S0025-5718-1993-1192971-8
  9. S. U. Lee and M. B. Choi, "The Integer Factorization Method Based on Congruence of Squares," Journal of Korean Institute of Information Technology, Vol. 12, No. 5, pp. 185-189, Oct. 2012.