Download presentation

Presentation is loading. Please wait.

Published byDaniel Bell Modified over 2 years ago

2
Prime Number Sieve 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Next_Prime = 2 ====> Mark multiples of 2 as non-prime. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Next_Prime = 3 ====> Mark multiples of 3 as non-prime.

3
Prime Number Sieve (cont’d) 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Next_Prime = 5 ====> Mark multiples of 5 as non-prime. 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 Next_Prime = 7 ====> Mark multiples of 7 as non-prime. Optimization #1 Q: Do you need to mark multiples of 11 between 1 and 50 ? A: No ! (They are already marked by the help of primes ≤ 7) Optimization #2 Q: Do you need to mark multiples of 7 between 1 and 48? A: No ! (They are already marked by the help of primes < 7)

4
Sequential Time Complexity Analysis Optimization #1: Optimization #2:

5
Parallel Time Complexity Analysis Another Formulation:

6
Programming Project: Parallel Prime Number Generation Read at: http://www.mst.edu/~ercal/387/387.htmlhttp://www.mst.edu/~ercal/387/387.html

Similar presentations

OK

Chun-Yuan Lin OpenMP-Programming training-5. “Type 2” Pipeline Space-Time Diagram.

Chun-Yuan Lin OpenMP-Programming training-5. “Type 2” Pipeline Space-Time Diagram.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on coffee shop business plan Ppt on service oriented architecture youtube Ppt on transportation in human beings the largest Ppt on game theory raleigh Best ppt on ozone layer Ppt on indian administrative services Ppt on types of forests in india Presentation ppt on gerd Ppt on grease lubrication in rolling Ppt on renewable energy for today and tomorrow