191k views
3 votes
Explain how you can find all the prime numbers from 201 to 1,000

User DobotJr
by
7.3k points

1 Answer

5 votes

This is a job for a computer.

It does it by brute force. Here are the steps.

for i = 201 to 1000

check if i is even by doing i mod 2 = 0 then exit this routine. that is if 0 shows up when you do a mod operation on it then leave. The number you are testing is even. Even numbers except 2 are not prime.

next find the square root of i. divide by all the odd number up to that square root.

for j = 3 to sqrt(i) step 2

if i mod j = 0 then exit this subroutine

if you find nothing that divides into i then record the number as prime.j

Try an example

201 is not prime it is divisible by 3

205 is not prime it is divisible by 5

207 is not prime it is divisible by 3

209 well let's see what happens to 209

the square root of 209 is 14

209 is not divisible by 3

209 is not divisible by 5

209 ÷ 7 = 29.85 so 7 does not go into 209 evenly

209 is not divisible by 9. If 3 doesn't work, 9 won't either.

209 ÷ 11 = 19 wwwooops. This number is not prime. 11 divides into it equally.


This method works extremely well for small numbers like 201 to 1000. It is hopeless for much larger numbers.

User Mattias Ottosson
by
7.1k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.