At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
The fundamental task in looking for prime numbers is to confirm that your candidate is not a multiple of any prime number less than itself. To accomplish this, you can either keep a list of the prime numbers you find, and check each candidate for candidate % prime for each prime you have found. If you can't find a prime for which candidate % prime == 0, then candidate is a prime.
A somewhat simpler (perhaps) solution would be to check each candidate against the numbers smaller than itself and see if any of them divide your candidate. If so then it must have a prime factor and is therefore non-prime.
You would check the number from 2 to the square root of the number you are trying to decide if it is prime or not. If any of them divide evenly (most programs have a mod type function which returns the remainder of a division problem) then it is not prime. No reason to check past the square root of the number.
see that a prime number yields a remainder 0 only when it is divide by itself and 1.so make a variable to count how many numbers yields a remanider 0 when the given number is divided by a series of numbers.if the variable count is 2 then it is a prime.