Part 2: Shared Memory Programming Q1: Goldbach’s conjecture is one of the oldest and best-known unsolved problems in the

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Part 2: Shared Memory Programming Q1: Goldbach’s conjecture is one of the oldest and best-known unsolved problems in the

Post by answerhappygod »

Part 2: Shared Memory Programming
Q1:
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-1000.
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.
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.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply