View Single Post
 
Old March 26th, 2017, 04:17 PM
mwheel0ck mwheel0ck is offline
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2017
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reply

Hi,

I am not sure if you are still looking for an answer.

The coder as written will check the lower and upper. The reason these get checked is the following line of code:

Code:
for(long possiblePrime=min;possiblePrime <=max;possiblePrime++)
This sets and loops through the candidate prime list. It starts with the min value (set to 2 in example) and finishes with 1000 (including 1000 because of the <= test).

If you didn't want to include 2 and 1000, you could change the code to:
Code:
for(long possiblePrime=min+1;possiblePrime <max;possiblePrime++)
This would eliminate the lower bound by starting with one larger than it and the upper bound by stopping before testing it.

Michael