Parallel Processing to Determine Prime Factors Matt Roberts Hood College CS566 Abstract Abstract – Prime number factorization can be computationally intensive. So much so, that prime number factorization is used in RSA Encryption [6] as public and private keys. The Prime number itself has had the attention of many groups who are trying to find the largest Mersenne Prime number, such as GIMP [7]. This paper will document a type of research and experiment used to introduce parallel processing into computation of prime factorization of large numbers. The introduction of parallel processing is suggested to speed up processing of prime factorization and relieve the computational intensiveness. If proven useful, this method of parallel processing could be used in many areas of prime factorization. 1. Introduction A prime number is a number greater than 1 with no divisors other than itself and 1, such as 2 and 11. The first few prime numbers are 2, 3, 5, 7, 11, 13 and 17. [3] These primes are fundamentally utilized first when determining a large number’s prime factorization. Numbers that are not “prime” contain factors. Factors are prime numbers multiplied to obtain the original number. 8 = 2 x 2 x 2 “The 2s are factors of 8.” This break down of a larger number is also considered Prime factorization. To determine a larger number’s prime factors it is best to start working from the smallest prime number. 18 / 2 = 9 9 is not a prime number, so we continue iterating of the result, by dividing by small primes. 9/3=3 Finally when hit a prime number as a result, so the prime factors of 18 are 2 x 3 x 3 or 2 x 3^2. This method can also be used to determine if a number is a prime number itself. While iterating over a large number, if there are no known prime numbers that can be divided into it, then the large number cannot be factorized and it is considered a prime number. The largest prime number known is 12978189. It was discovered on 08/23/2008 by Edson Smith, George Woltman and Scott Kurowski. The code they used is called G10 and it accounts for 4.762% of the active known primes, 21 total. To reach the largest prime number known this group of programmers used a distributed computing project on the internet called the “Great Internet Mersenne Prime Search” (GIMPS). A Mersenne Prime Number is a number that is prime. It is know that if 2^p – 1 is prime then p is also prime. [8] GIMPS utilize distributed computing to find Mersenne Prime Numbers. In this paper we shall propose that basic prime factorization of large numbers can also be done using parallel processing. In addition, this paper proposes that a significant decrease in the amount of time taken to process the factorization of large numbers can be achieved through parallel processing. If this if true, then it is possible that parallel processing could enhance GIMPS search for Mersenne Prime Numbers by incorporating parallel processing in their own programs. 2. Literature Review There have been and are many experiments on parallel processing that try to speed up prime factorization. One such experiment was performed by the Transactions of the Institute of Electrical Engineers of Japan. There experiment was title “Experiments on Distributed Parallel Processing for Speeding up Prime Factorization in the Elliptic Curve Method”. [5] Tsurusawa Hidenobu, Nakayama Shigeru, Fuchida Takayasu and Murashima Sadayuki, all from Kagoshima University, carried out distributed parallel processing using 50 computers connected to one network. Similar to the 8 computer nodes connected to the Pluto network at Hood College, but on a large scale. These students developed a distributed parallel calculation of the prime factorization in the elliptic curve method to adapt to object shared space and performed the parallel processing with a worker-master methodology. The results of their experiment indicated that the speed of prime factorization of large integers increases with each added computer to the distributed network of slave nodes. In addition, their results illustrated that the calculation time of prime factorization mainly depends on the size of the prime factors. 3. Methodology The algorithm or method to compute primes and their factors is by repeatedly dividing a number with small prime factors until the resulting number becomes 1. Suppose we have the number 50, we find the smallest number that actually divides 50, which is using 2. Next 50 divided by 2 becomes 25, leaving the resulting number as 25. The program stores 2 in an array and then iterates over the result. We find the smallest prime number that actually divides 25, which is 5. 25 is then divided by 5 to get 5 as a result. The program stores 5 in an array and then iterates once again over the result. The program tries to find a prime that divides into 5, but it cannot since 5 is a prime. 5 is then stored in the resulting array. The resulting array now contains the prime factorization of 50. Number / Prime Number = Result Resulting Array = [2 x 5 x 5] Since this research program is to determine if parallel processing can decrease the amount of time needed to factorize large numbers and it is not to attempt to find new prime numbers, a data source of all know prime numbers will be used during factorization processing. The resource for prime numbers can be found at http://primes.utm.edu/ , which contains the “proclaimed” largest know database of known prime numbers. The Message Passing Interface (MPI) will be the primary methodology used to illustrate parallel processing of prime factorization. MPI is a directory of C programs that use the MPI library of message passing routines. The library allows a user to write a program in a familiar language like C and carry out a computation or process in parallel on an arbitrary number of cooperating computers or processors. The MPI program will use 8 computer nodes on the PLUTO network at Hood College’s Computer Science Linux lab. 4. Expected Results The expected results will be that parallel processing greatly enhances prime factorization processing of large numbers. The computation may even become embarrassingly parallel. To compare the results of a parallel program, this research will perform the same prime number factorization computations without the addition of MPI to gain the results of one node performing the task. The results will then been displayed and plotted on a graph to show the differences. Time pending, other alternatives may be added, such as using CUDA as the parallel processing interface to see if we get better or worse results when the GPU used to perform prime factorization. In addition, other resources have been made available such as NSA’s teraGrid, which contains a larger scale of nodes. Using a large scale of computers may provide unexpected results or better solidify the assumption of this paper that parallel processing decreases the amount of time needed to factorize prime numbers. 5. References [1] Mir Shahriar Emami, Mohammed Reza Meybodi, A Post Processing Method for Quantum Prime Factorization Algorithm based on Randomized Approach, http://www.waset.org/journals/waset/v34/v3424.pdf [2] Washington University in St. Louis, Department of Mathematics, Find the Prime Factors of a Number, http://www.math.wustl.edu/cgi-bin/primes [3] ICRA, Math is Fun, http://www.mathsisfun.com/primefactorization.html [4] The Largest Known Primes!, http://primes.utm.edu/primes/ [5] TSURUSAWA HIDENOBU(Kagoshima Univ.) NAKAYAMA SHIGERU(Kagoshima Univ.) FUCHIDA TAKAYASU(Kagoshima Univ.) MURASHIMA SADAYUKI(Kagoshima Univ.), Experiments on Distributed Parallel Processing for Speeding up Prime Factorization in the Elliptic Curve Method, http://sciencelinks.jp/jeast/article/200215/000020021502A0501489.php [6] Tom Davis, RSA Encryption, October 10, 2003, http://www.geometer.org/mathcircles/RSA.pdf [7] GIMP, http://www.mersenne.org/freesoft/#source [8] Mersenne Prim, Wikipedia, http://en.wikipedia.org/wiki/Mersenne_prime