Finding N Prime Numbers Using Distrusted Computing PVM (Parallel Virtual Machine) Ehab Abdulrazak Al-Asadi College of Science-Kerbala University
Total Page:16
File Type:pdf, Size:1020Kb
ISSN : 2394-2975 (Online) International Journal of Advanced Research ISSN : 2394-6814 (Print) Vol. 2, Issue 4 (Oct. - Dec. 2015) in Education & Technology (IJARET) Finding N Prime Numbers Using Distrusted Computing PVM (Parallel Virtual Machine) Ehab AbdulRazak Al-Asadi College of Science-Kerbala University Abstract Analysis the feasibility of sequencing as a parallel algorithm for the search for the first N Prime numbers. Design and implement (in C / C ++) program, respectively. Programs in the sequence Algorithm and also a solution based on the transmission of messages between nodes using library system PVM. Both programs must be identical. Distribute the load between nodes so that the computing time A minimum. Find out what is the dependence of acceleration of the implementation and calculation of the number of nodes and the extent of the problem in relation to sequencing program, (insert table and graphs). On the basis of Results estimate: latency communication, for what is the role of the dimension of the architecture (right) Scalable and what is the maximum size when the calculation is available on the architecture more bearable. Discuss in your group about what is the advantage respectively. The efficiency of parallel execution Individual algorithms. If this solution requires the use of input and output files with rows matrix Corresponds to file line and column valuesare separated by spaces or tabs. Otherwise stated, work with real numbers. Keywords Prime Numbers, Eratosthenes sieve, Parallel Program, Mersenne Prime number. I. Introduction the first 1,000,000 primes this holds true. Checking a million PVM (Parallel Virtual Machine) is a software system that enables primes is certainly energetic, but it is not necessary (and just a collection of heterogeneous computers to be used as a coherent looking at examples. Can be misleading in mathematics). Here and flexible concurrent computational resource. The individual is how to prove your observation: take any integer n greater Than computers may be shared- or local-memory multiprocessors, 3, and divide it by 6. That is, write n = 6q + r Where q is a non- vector supercomputers, specialized graphics engines, or scalar negative integer and the remainder r is one of 0, 1, 2, 3, 4, or 5. workstations that may be interconnected by a variety of networks, if the remainder is 0, 2 or 4, then the number n is divisible by such as Ethernet, FDDI, etc. PVM support software executes on 2, and cannot be prime. if the remainder is 3, then the number each machine in a user-configurable pool, and presents a unified, n is divisible by 3, and cannot be prime. So if n is prime, then general, and powerful computational environment of concurrent the remainder r is either 1 (and n = 6q + 1 is one more than a applications. User programs written in C or FORTRAN are provided multiple of six), or 5 (and n = 6q + 5 = 6(q+1) - 1 is one less than access to PVM through the use of calls to PVM library routines a multiple of six).[2] for functions such as process initiation, message transmission and reception, and synchronization via barriers or rendezvous. B. Prime Numbers Group Users may optionally control the execution location of specific application components. The PVM system transparently handles Mersenne Prime number message routing, data conversion for incompatible architectures, In mathematics, a Mersenne number is a number that is one less and other tasks that are necessary for operation in a heterogeneous, than a power of two, Mn = 2n − 1. network environment. As of August 2007, only 44 Mersenne primes are known; the PVM is particularly effective for heterogeneous applications that largest known prime number (232,582,657−1) is a Mersenne prime exploit specific strengths of individual machines on a network. As and in modern times the largest known prime has nearly always a loosely coupled concurrent supercomputer environment, PVM is Been a Mersenne prime. Like several previous Mersenne primes, it a viable scientific computing platform. The PVM system has been was discovered by a distributed Computing project on the Internet, used for applications such as molecular dynamics simulations, known as the Great Internet Mersenne Prime Search (GIMPS). superconductivity studies, distributed fractal computations, [1]. Prime numbers have long fascinated amateur and professional matrix algorithms, and in the classroom as the basis for teaching mathematicians. An integer greater Than one is called a prime concurrent computing.Eratosthenes sieve number if its only divisors are one and itself. The first prime numbers Are 2, 3, 5, 7, 11, etc. For example, the number 10 is 2. Analysis not prime because it is divisible by 2 and 5. A Mersenne prime is a prime of the form 2P-1. The first Mersenne primes are 3, 7, 31, A. Prime Number 127 (Corresponding to P = 2, 3, 5, 7). There are only 44 known In mathematics, a prime number (or a prime) is a natural number Mersenne primes. which has exactly two distinct Natural number divisors: 1 and itself. Infinitude of prime numbers exists 2, 3, 5, 7, 11, 13, 17, Fibonacci primenumber 19, 23, 29,……………[1] The prime number which is synchronize fibonacci number series Perhaps the most rediscovered result about prime’s numbers is numbers in the each second. Member is counts two former, the following: however not every fibonacci number is prime number 2, 3, 5, I found that every prime number over 3 lies next to a number 13, 89, 233, 1597, ... divisible by six. Using Matlab with The help of a friend, we wrote a program to test this theory and found that at least within www.ijaret.com 45 © IJARET All Rights Reserved International Journal of Advanced Research ISSN : 2394-2975 (Online) in Eduation & Technology (IJARET) Vol. 2, Issue 4 (Oct. - Dec. 2015) ISSN : 2394-6814 (Print) Emirp third integer, i.e., 6, 9, 12, etc. Note An Emirp (prime spelt backwards) is a prime number that results That we mark 6, 12, 18, etc. again. in a different prime when its Digits are reversed. This definition 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 excludes the related palindromic primes. Emirps are also called 25 26 27 Reversible primes. The sequence of emirps begins 13, 17, 31, 37, Now 5 is the next prime, and we mark every fifth integer. The 71, 73, 79, 97, 107, 113, 149, 157.. only new integer marked in range is 25. C. Algorithms for Searching the Prime Numbers 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 To create list of prime numbers existing different algorithms from 26 27 from here we those remember two – Eratosthenes Sieve a Brute Force Find the primes 7, 11, 13, 17, 19, and 23.[2] Eratosthenes sieve D. What Can Influence the Solution and the Results The basic algorithm to find the prime number and his properties The system performance and distributed computation performance A prime number is a natural number greater than 1 that can be (in compare with sequential Computation) are influenced by several divided without remainder only by conditions: Performance of computers themselves – processor Itself and by 1. Natural numbers n that can be divided by a number performance, memory Network and its capabilities that connects less than n and greater than 1 the hosts Actual … (it depends on the number of the hosts and Are composite numbers. The Sieve of Eratosthenes identifies all of its usage with other processes) prime numbers up to a given Number n as follows: III. The Design 1. Write down the numbers 1, 2, 3, ..., n. We will eliminate composites by marking them. Initially all numbers are A. Mathematical Assumption unmarked. In computation we will take advantage of these mathematical 2. Mark the number 1 as special (it is neither prime nor formulas: composite). All primary numbers (bigger than 3) are in form: primary number 3. Set k=1. Until k exceeds or equals the square root of n do = 6n ± 1, where n=1,2,3,.. to know whether the number X has this: divisors (except 1 and itself) it is sufficient to divide it By numbers o Find the first number in the list greater than k that has not been from 2 to √X. First two primary numbers (2 and 3) are known – identified as Composite. (The very first number so found is 2.) first formula is valid for numbers bigger than 3. Call it m. Mark the numbers o 2m, 3m, 4m, B. Tasks Division As composite. (Thus in the first run we mark all even numbers I’ll divide the task so that the architecture master-worker will be greater than 2. In the Second run we mark all multiples of 3 greater created. Master’s task will be to Process input data (number of than 3.) m is a prime number. Put it on your list. nodes on which the computation will be executed and the number o Set k=m and repeat. of Wanted primary numbers), dividing data for processing in . Put the remaining unmarked numbers in the sequence on your worker nodes, process the data from Worker nodes and evaluate list of prime numbers. [7] results (storing the results in files). The worker’s task will be to This algorithm can be written in pseudo-code as follows decide whether a number (sent by master) is/ is not a primary Eratosthenes(n) { number And to send the result back to master. a[1] := 0 for i := 2 to n do a[i] := 1 C.