How this prime number calculator works
Enter a whole number. The calculator reports whether it is prime. A prime has exactly two distinct positive divisors: 1 and itself. 7 is prime. 4 is not, because 2 × 2 = 4. The result line shows “Prime Number” or “Not Prime Number.” Until you type a value, it stays as “--.”
The check follows the same rules as the code. Any value that is not an integer, or is less than 2, counts as not prime, so 1, 0, negatives, and decimals all fail. 2 is accepted immediately as the only even prime. Every other even number fails because it is divisible by 2.
Odd candidates are tested against odd divisors from 3 through the square root of the number. If any divisor divides evenly, the number is composite. If none do, it is prime. 9 fails because 3 divides it. 97 has no such divisor through about 9.8, so it is prime. 100 fails at once as an even number greater than 2.
This page only answers yes or no. It does not list factors. For a product of primes such as 12 = 2 × 2 × 3, use a prime factors tool. Here you only learn whether the number itself is prime.