refactored to eliminate repeated instantiation
tests for non-prime numbers