Answer to Question #318000 in Algorithms for asdasd

Question #318000

Using the Sieve Algorithm remove all non-prime numbers on the given below. (Show your complete solution.)



1. 2 3 4 5 12 13 15 24 25 29 38 39 43 57 58 61



2. 2 3 4 5 103 104 105 106 107 108 109 110 111 112 113 114 115

1
Expert's answer
2022-03-25T12:09:50-0400

1.

Initial sequence:

2 3 4 5 12 13 15 24 25 29 38 39 43 57 58 61


select the first prime number 2

starting with a number greater than 2 remove all numbers that are divided by 2

2 3 5 13 15 25 29 39 43 57 61


As 61 is greater than 2*2 continue

select the next prime number 3

starting with a number greater than 3 remove all numbers that are divided by 3

2 3 5 13 25 29 43 61


As 61 is greater than 3*3 continue

select the next prime number 5

starting with a number greater than 5 remove all numbers that are divided by 5

2 3 5 13 29 43 61


As 61 is greater than 5*5 continue

select the next prime number 7

starting with a number greater than 7 remove all numbers that are divided by 7

2 3 5 13 29 43 61


As 61 is greater than 7*7 continue

select the next prime number 11


As 61 is less than 11*11 = 121 the algorithm terminated



2.

Initial sequence:

2 3 4 5 103 104 105 106 107 108 109 110 111 112 113 114 115


Select the first prime number 2

starting with a number greater than 2 remove all numbers that are divided by 2

2 3 5 103 105 107 109 111 113 115


As 115 is greater than 2*2 continue

select the next prime number 3

starting with a number greater than 3 remove all numbers that are divided by 3

2 3 5 103 107 109 113 115


As 115 is greater than 3*3 continue

select the next prime number 5

starting with a number greater than 5 remove all numbers that are divided by 5

2 3 5 103 107 109 113


As 113 is greater than 5*5 continue

select the next prime number 7

starting with a number greater than 7 remove all numbers that are divided by 7

2 3 5 103 107 109 113


As 61 is greater than 7*7 continue

select the next prime number 11


As 113 is less than 11*1 = 121 the algorithm terminated





Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS