# Prime Number Checker

## What is a prime number ?

A prime number is a positive integer that has exactly two positive divisors that are 1 and itself.

Examples:

- 19 is a prime number because it has no positive divisor other than 1 and 19.

- 49 is not a prime number because it has a positive divisor other than 1 and itself which is 7 (49 = 7 x 7).

## How to check if a number is prime ?

The obvious method is to try to divide it by all the prime numbers lower than its square root.

Example: is 101 a prime number?

- we calculate the square root of 101, it is approximately equal to 10.04.

- we try to divide 101 by all prime numbers less than or equal to 10 i.e. 2 3 5 7 (list of prime numbers). We do successively the Euclidean division of 101 by 2.3.5 and 7.

- 101 is not divisible by these numbers, so it is prime.

It is useful to know divisibility rules in order to quickly find out if a number is divisible by 2, 3, 5... without doing an Euclidean division: Divisibility rules.

## List of prime numbers

- **Prime numbers from 1 to 10**

2 3 5 7

- **The prime numbers from 11 to 100**

11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97

- **Prime numbers from 101 to 1000**

101 103 107 109 113 127 131 137 139 149 149 151 157 163 167 173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257 263 269 277 277 281 283 293 293 307,311,313 317 331 337 347 349 353 359 367,373 373 379 383 389 397 401 409 419 421 431 433,433 439 443,449 457 461 463 467 479 479 487 491 499 503,509,521 523 541 547 557 563,569 571 577 587 593,599 601 607 613 617 619 631 641 643,647 653 659 661,673,677 683 691,701,709,719 727 733,739 743,751 757 769,773 787 797 809 811 821,823 827 829 839 853 857,859 863 877 881 883 887 907,911,919 929 937 941 947 953 967 967 967 71,977 983 991 997

## Programming

Here is a program that checks whether a number is prime (primality checker).### Python

```
# Primality check for x > 1
def is_prime (x):
for i in range (2, x-1):
if x% i == 0:
return False
return True
```

## See also

Find all divisors of a number

Prime numbers search

Euclidean Division