Prime Number Checker
Prime or composite, with the divisibility test worked out step by step
Prime, Composite, and Why 1 Is Neither
A prime number is a whole number greater than 1 with exactly two distinct divisors: 1 and itself. A composite number has more than two. So 7 is prime (only ), while 9 is composite ( and ).
1 is not prime. It has only one divisor, not two. That is not a technicality invented to annoy students: if 1 counted as prime, every number would have endlessly many prime factorisations (), and the guarantee that each number factors into primes in exactly one way would collapse.
2 is prime — and it is the only even prime, because every other even number has 2 as a third divisor. Students often expect 2 to be the exception in the other direction; it is not.
The first primes are .
The Test: Divide by Primes up to √n
To check whether is prime, try dividing by each prime from 2 upward, and stop once the prime exceeds .
Why stop there? If with both factors above , then — impossible. So any composite number must have a factor at or below its square root. For , , so testing 2, 3, 5 and 7 settles it completely.
The divisibility shortcuts make this fast without a calculator:
| Divisor | Test |
|---|---|
| 2 | last digit is even |
| 3 | digit sum is a multiple of 3 |
| 5 | last digit is 0 or 5 |
| 7 | double the last digit, subtract from the rest |
| 11 | alternating digit sum is a multiple of 11 |
One clean division with no remainder is enough to declare the number composite — you can stop immediately.
Numbers That Trick People
- 51 looks prime but is a multiple of 3, so .
- 91 slips past the 2, 3 and 5 tests, then fails at 7: .
- 361 is , so it is composite even though nothing small divides it. Always test all the way to before declaring a number prime.
- 9 is not prime. Odd does not mean prime; .
- Stopping too early. Checking only 2, 3 and 5 on a three-digit number proves nothing. For you must reach 13, since .
- Confusing this with prime factorisation. "Is 113 prime?" asks for yes or no; "prime factors of 113" asks for the full breakdown — which here is just itself, because 113 is prime.
示例题目
常见问题
No. A prime must have exactly two distinct divisors, and 1 has only one. Excluding it is what makes prime factorisation unique — otherwise you could pad any factorisation with as many 1s as you liked.
Yes, and it is the only even prime. Every other even number is divisible by 1, itself and 2, which gives it at least three divisors. So 2 is prime and 4, 6, 8 and every larger even number is composite.
Only up to the square root of the number, and only by primes. If a number had two factors both larger than its square root, their product would exceed the number itself, so a composite number always has a factor at or below the square root.
No. 9 equals 3 times 3, so it has three divisors: 1, 3 and 9. Being odd is not the same as being prime — 9, 15, 21, 25, 27 and 33 are all odd composites.
相关求解器
免费试用 AI-Math
任何数学问题都能获得分步解答。拍照上传或输入问题即可。
开始解题