# Prime Number Calculator

Enter a number and the Prime Number Calculator will instantly tell you if it is a prime number or not.

#### What is a Prime Number?

A prime number is any integer, or whole number, greater than 1 that is only divisible by 1 and itself. In other words, a prime number only has two factors, 1 and itself.

#### Examples :

Is 2 a prime number? Yes, 2 is a prime number because it only has two factors, 1 and 2.
Is 17 a prime number? Yes, 17 is a prime number because it only has two factors, 1 and 17.

## How to use our prime number calculator?

With our prime calculator, you'll check if any given number is prime or composite. Keep reading if you would like to find out what a major number is, and the way to see if variety is Prime. We also discuss the way to find prime numbers, also as what relatively prime numbers are. As a bonus, we tell you if 1 is Prime, and also what the oddest prime is.

## What is the major number?

A number greater than 1 is named prime if it's exactly two factors, i.e., if the amount is divisible only by 1 and itself.

When a number is bigger than 1 and is not prime, then it's called a number.

What about 1? 1 is neither prime nor composite because it has just one factor (itself).

Let's discuss some examples:

7 is prime because its only factors are 1 (one) and 7 (seven). Indeed, none of the amount preceding 7 (2, 3, 4, 5, and 6) may be a factor of it, because none of those numbers divide 7 without a remainder.

8 is composite because 2 may be a factor of 8, then 8 has more factors than simply 1 (one) and (8) eight.

Fact; the oddest number amongst primes is 2, because it is that the only even prime: all other primes are odd!

## How to use our prime calculator?

Well, this prime calculator isn't a really complicated one. Just enter the amount you would like to see into the calculator and voila! Your answer is going to be shown below.

If your number is composite, the calculator will tell you it’s smallest non-trivial factor (non-trivial here means an element greater than one).

### How to check if variety is prime or composite?

The easiest thanks to verify that a given integer n is prime is to use the so-called trial division algorithm: it consists of testing whether n is divisible by any number between 2 and n-1. That's tons of computations. Fortunately, the amount of trials is often reduced; it's sufficient to see only the divisibility of n by prime numbers which don't exceed √n. A version of the trial division algorithm powers this prime calculator.

### How to find prime s?

Well, you can't find every prime, because Euclid proved sometime around 300 BC that there are an infinite number of them. If you would like to seek out all prime numbers up to some given limit, n, you'll resort to the algorithm referred to as the Sieve of Eratosthenes:

Write down all numbers from 2 to n

Start with the littlest number in our list: 2. Circle 2 and cross off all consecutive multiples of two (i.e., 4, 6, 8... 120)

Take the littlest number that's not circled or crossed out: 3. Circle it and cross off all its further multiples: 3, 6, 9...

Continue during this same way: find the littlest available number p, circle it and cross off all of its consecutive multiples

Check if there are numbers greater than p not yet crossed out. If so, repeat Step 4. If no, we're done.

The circled numbers within the list are all the primes below n.

The main idea here is that each number assigned to p in any step of the algorithm is necessarily Prime; otherwise, it might be crossed out as a multiple of some smaller, already circled, prime number.

In the animation below you see the Sieve of Eratosthenes checking out all primes up to 120. Here's the color legend:

Red: multiples of two

Green: multiples of three

Blue: multiples of 5

Yellow: multiples of seven

The remaining purple numbers are Prime.

A.