Computationally Efficient Search for Large Primes
Total Page:16
File Type:pdf, Size:1020Kb
New Jersey Institute of Technology Digital Commons @ NJIT Theses Electronic Theses and Dissertations Summer 8-31-2001 Computationally efficient search for large primes Wieslawa E. Amber New Jersey Institute of Technology Follow this and additional works at: https://digitalcommons.njit.edu/theses Part of the Computer Sciences Commons Recommended Citation Amber, Wieslawa E., "Computationally efficient search for large primes" (2001). Theses. 749. https://digitalcommons.njit.edu/theses/749 This Thesis is brought to you for free and open access by the Electronic Theses and Dissertations at Digital Commons @ NJIT. It has been accepted for inclusion in Theses by an authorized administrator of Digital Commons @ NJIT. For more information, please contact [email protected]. Copyright Warning & Restrictions The copyright law of the United States (Title 17, United States Code) governs the making of photocopies or other reproductions of copyrighted material. Under certain conditions specified in the law, libraries and archives are authorized to furnish a photocopy or other reproduction. One of these specified conditions is that the photocopy or reproduction is not to be “used for any purpose other than private study, scholarship, or research.” If a, user makes a request for, or later uses, a photocopy or reproduction for purposes in excess of “fair use” that user may be liable for copyright infringement, This institution reserves the right to refuse to accept a copying order if, in its judgment, fulfillment of the order would involve violation of copyright law. Please Note: The author retains the copyright while the New Jersey Institute of Technology reserves the right to distribute this thesis or dissertation Printing note: If you do not wish to print this page, then select “Pages from: first page # to: last page #” on the print dialog screen The Van Houten library has removed some of the personal information and all signatures from the approval page and biographical sketches of theses and dissertations in order to protect the identity of NJIT graduates and faculty. ABSTRACT COMPUTATIONALLY EFFICIENT SEARCH FOR PRIME NUMBERS by Wieslawa E Amber To satisfy the speed of communication and to meet the demand for the continuously larger prime numbers, the primality testing and prime numbers generating algorithms require continuous advancement. To find the most efficient algorithm, a need for a survey of methods arises. Concurrently, an urge for the analysis of algorithms' performances emanates. The critical criteria in the analysis of the prime numbers generation are the number of probes, number of generated primes, and an average time required in producing one prime. Hence, the purpose of this thesis is to indicate the best performing algorithm. The survey the methods, establishment of the comparison criteria, and comparison of approaches are the required steps to find the best performing algorithm. In the first step of this research paper the methods were surveyed and classified using the approach described in Menezes [66]. While chapter 2 sorted, described, compared, and summarized primality testing methods, chapter 3 sorted, described, compared, and summarized prime numbers generating methods. In the next step applying a uniform technique, the computer programs were written to the selected algorithms. The programs were installed on the Unix operating system, running on the Sun 5.8 server to perform the computer experiments. The computer experiments' results pertaining to the selected algorithms, provided required parameters to compare the algorithms' performances. The results from the computer experiments were tabulated to compare the parameters and to indicate the best performing algorithm. Survey of methods indicated that the deterministic and randomized are the main approaches in prime numbers generation. Random number generation found application in the cryptographic keys generation. Contemporaneously, a need for deterministically generated provable primes emerged in the code encryption, decryption, and in the other cryptographic areas. The analysis of algorithms' performances indicated that the prime numbers generated through the randomized techniques required smaller number of probes. This is due to the method that eliminates the non-primes in the initial step, that pre-tests randomly generated primes for possible divisibility factors. Analysis indicated that the smaller number of probes increases algorithm's efficiency. Further analysis indicated that a ratio of randomly generated primes to the expected number of primes, generated in the specific interval is smaller than the deterministically generated primes. In this comparison the Miller-Rabin's and the Gordon's algorithms that randomly generate primes were compared versus the SFA and the Sequences Containing Primes. The name Sequences Containing Primes algorithm is abbreviated in this thesis as 6kseq. In the interval [99000,100000] the Miller Rabin method generated 57 out of 87 expected primes, the SFA algorithm generated 83 out of 87 approximated primes. The expected number of primes was computed using the approximation n/ln(n) presented by Menezes [66]. The average consumed time of originating one prime in the [99000,100000] interval recorded 0.056 [s] for Miller-Rabin test, 0.0001 [s] for SFA, and 0.0003 [s] for 6kseq. The Gordon's algorithm in the interval [1,100000] required 100578 probes and generated 32 out of 8686 expected number of primes. Algorithm Parametric Representation of Composite Twins and Generation of Prime and Quasi Prime Numbers invented by Doctor Verkhovsky [108] verifies and generates primes and quasi primes using special mathematical constructs. This algorithm indicated best performance in the interval [1,1000] generating and verifying 3585 variances of provable primes or quasi primes. The Parametric Representation of Composite Twins algorithm consumed an average time per prime, or quasi prime of 0.0022315 [s]. The Parametric Representation of Composite Twins and Generation of Prime and Quasi Prime Numbers algorithm implements very unique method of testing both primes and quasi-primes. Because of the uniqueness of the method that verifies both primes and quasi-primes, this algorithm cannot be compared with the other primality testing or prime numbers generating algorithms. The ((a!)^2)*((-1)^b) Function In Generating Primes algorithm [105] developed by Doctor Verkhovsky was compared versus extended Fermat algorithm. In the range of [1,1000] the [105] algorithm exhausted an average 0.00001 [s] per prime, originated 167 primes, while the extended Fermat algorithm also produced 167 primes, but consumed an average 0.00599 [s] per prime. Thus, the computer experiments and comparison of methods proved that the SFA algorithm is deterministic, that originates provable primes. The survey of methods and analysis of selected approaches indicated that the SFA sieve algorithm that sequentially generates primes is computationally efficient, indicated better performance considering the computational speed, the simplicity of method, and the number of generated primes in the specified intervals. COMPUTATIONALLY EFFICIENT SEARCH FOR LARGE PRIMES by Wieslawa E. Amber A Thesis Submitted to the Faculty of New Jersey Institute of Technology In Partial Fulfillment of the Requirements for the Degree of Master of Science in Computer Science Computer Science Department August 2001 APPROVAL PAGE COMPUTATIONALLY EFFICIENT SEARCH FOR LARGE PRIMES Wieslawa E. Amber Dr. Boris S. Verkhovsky, Thesis Advisor Date Professor of Computer Science Department, NJIT Dr. James A. M. McHugh, Graduate Chairman Date Chairman of Computer Science Department, NJIT Dr. Fadi P. Deek, Associate Professor of Information Systems Date Associate Dean of Computer Science Systems, NJIT BIOGRAPHICAL SKETCH Author: Wieslawa E. Amber Degree: Master of Science Date: August 2001 Undergraduate and Graduate Education: Master of Science in Computer Science New Jersey Institute of Technology, Newark, NJ, 2001 Bachelor of Science in Mechanical Engineering New Jersey Institute of Technology, Newark, NJ, 1995 Major: Computer Science ACKNOWLEDGEMENT I am very grateful for having Professor Boris S. Verkhovsky, Ph.D. as the thesis advisor and for being his student. I have been gratified for the valuable and countless advice, encouragement, information, support, and suggestions I received from Professor Verkhovsky, that helped bring to life this project. My sincere words of appreciation are addressed to Dr. James A. M. McHugh, Graduate Chairman and to Dr. Fadi P. Deek, Associate Dean of Computer Science Systems for actively participating in my committee. I wish to thank the Professors and Faculty Members who taught me fundamentals to make this thesis possible. I appreciate the assistance and help I received from the CIS department staff over the years. I would like to thank Ms. Clarisa Gonzalez-Lenahan for her assistance. vi TABLE OF CONTENTS Chapter Page 1 INTRODUCTION... 1 1 1.2 Background Information... ... ......................................... 1 2 PRIMALITY TESTING METHODS... ... ............ ............ ........ 5 2.1 Problem Statement... ......... ......... ......... 5 2.2 Previous Works... ... ......... .................. ............ ......... 5 2.2.1 Probabilistic Primality Tests... ... ............... ............... 6 2.2.2 True Primality Tests 11 2.3 Algorithms' Performance Evaluation 20 2.4 Summary__ ......... ............ ..................... ............ ........... 20 3 PRIME NUMBERS GENERATING