Prime Number Calculator

Enter the number you want to determine if it is prime or not.

How to Use


What is a prime number?

A prime number is two or more integers that have no positive divisors other than 1 and itself.

For example, 3 is prime because the divisor of 3 is only 1 and 3.

8 has divisors 1, 2, 4, and 8, so 8 is not prime.

All of the following numbers are prime.

\[ 2,3,5,7,11,13,17,19,\cdots \]


How to determine if a number is prime

The following rules are used to determine the prime number of a number.

Divide \(n\) by a prime number less than or equal to \( \sqrt{n} \), and if all are divisible, then \(n\) is prime.

As an example, let us check if 97 is a prime number.

Since \( \sqrt{97}=9.84\cdots \) , we calculate whether 97 is divisible by 2,3,5,7, which are prime numbers less than or equal to 9.

\begin{align} 97\div2&=48\cdots1\notag\\ 97\div3&=32\cdots1\notag\\ 97\div5&=19\cdots2\notag\\ 97\div7&=13\cdots6\notag\\ \end{align}

Since it was not divisible by all these numbers, 97 is prime.


Example

Example 1

Determine whether 139 is prime.

Solution

Since \( \sqrt{139}=11.7\cdots \), calculate whether it is divisible by a prime number less than or equal to 11.

\begin{align} 139\div\phantom{0}2&=69\cdots1\notag\\ 139\div\phantom{0}3&=46\cdots1\notag\\ 139\div\phantom{0}5&=27\cdots4\notag\\ 139\div\phantom{0}7&=19\cdots6\notag\\ 139\div11&=12\cdots7\notag \end{align}

Since 139 is not divisible by all these numbers, 139 is prime.


Example 2

Determine whether 351 is prime.

Solution

Since \( \sqrt{135}=18.73\cdots \), calculate whether it is divisible by a prime number less than or equal to 11.

\begin{align} 351\div2&=175\cdots1\notag\\ 351\div3&=117\cdots0\notag \end{align}

351 is not prime because it is divisible by 3.