Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q2) Goldbach's conjecture is one of the oldest and best-known unsolved problems in the number theory of mathematics. Every even integer greater than 2 can
Q2) Goldbach's conjecture is one of the oldest and best-known unsolved problems in the number theory of mathematics. Every even integer greater than 2 can be expressed as the sum of two primes. 1. write a function Gold(x) that takes an positive even number x>2 and it will return the number of distinct pairs of prime numbers exist whose addition is x. For example, Gold(8) should return 1 (since the only pair of prime numbers that gives 8 is (3,5) ), while Gold(14) should return 2 (there are two pairs, (7,7) and (3,11) ). 2. Write a program that will do the following: a- Create an array initialized to zero to store Gold(x) for all even numbers from 4-10,000. b. Loop over all the even numbers in the range, call Gold with the even number and save the result of Gold in the corresponding entry of the array. Use the prime numbers array produced by Q1. c. Check how many entries in the array for which the conjecture is violated. The points b and c should be performed as two loops. Parallelize the code using OpenMP. Try executing the program with 1, 2, 3, and 4 threads. Experiment with different scheduling strategies of the loop iterations (e.g., static, dynamic, guided, with different chunk sizes(at least 5)) and report your comparative results. Calculate speedup and efficiency. (20 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started