Does this algorithm find prime numbers only? I'm writing code to help find prime numbers within a certain range. Here's my general pseudo-code:


*

*Iterate through every single number in the range.

*If the number is 2, 3, 5, or 7; then mark it as a prime number.

*If the number is NOT divisible by 2, 3, 5, or 7; then it's also a prime number.


Think about it. Checking divisibility by 2 already removed even numbers. Three, five, and 7 are other fundamental prime numbers, so any other non-prime number has to be a divisor of any of these. I tested this algorithm with all numbers between 1-100, and it worked. But would it work for all numbers?

Hint:
1. Prime numbers greater than 5 are either can be formed as $6k-1$ or $6k+1$.
2. If x can not be divided by 2, 3, 5, 7,..., and k (k is the greatest prime number less than square root of x.) then x is prime.
Add your code.
