Write a parallel program using openMPI to determine for all integers less than 1
ID: 3601898 • Letter: W
Question
Write a parallel program using openMPI to determine for all integers less than 1,000,000, the number of times that two consecutive odd integers are both prime numbers.
Explanation / Answer
Because any other group of three consecutive odd numbers will contain a multiple of three, and will hence not be prime. Suppose x, x+2, and x+4 are all odd, and x > 3. If x is a multiple of three, then we've shown that one of them isn't prime. So assume x is not a multiple of three. Then x is either one more than a multiple of three or two more than a multiple of three. If x is one more than a multiple of three, then x+2 is a multiple of three and is hence not prime. If x is two more than a multiple of three, then x+4 is a multiple of three and is hence not prime. I hope this is clear. Please write back if you'd like to talk about this some more. - Doctor Paul, The Math Forum http://mathforum.org/dr.math/ Date: 11/16/2001 at 11:37:51 From: Doctor Jubal Subject: Re: Prime factors Hi Debbie, Thanks for writing Dr. Math. If you have a series of numbers n, n+2, n+4, exactly one of them must be divisible by three. Since every third number is divisible by three, any number can be written in one of these forms: 3k, 3k+1, 3k+2. If n is of the form 3k, then it is divisible by three. If n is of the form 3k+1, then n+2 = 3k+3, which is divisible by three. If n is of the form 3k+2, then n+4 = 3k+6, which is divisible by three. 3 is the only prime divisible by three, so 3, 5, 7 is the only series n, n+2, n+4 where all three numbers are prime. Does this help? Write back if you'd like to talk about this some more, or if you have any other questions.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.