# Prime Numbers Formula

When any number is divisible only by one and itself, i.e. the number has only two factors, then it is called a prime number. A prime number cannot be factorized because it does not have factors other than 1 and the number itself. The numbers which have more than two factors are called composite numbers. The prime numbers formula helps in checking if the given number is prime or not. It helps in generating a random prime number. In this section, we will be learning more about the prime numbers formula and solving a few examples.

## What is Prime Numbers Formula?

Any whole number greater than 1 that is divisible only by 1 and itself, is defined as a prime number. To check if a number is prime or not: find all the possible factors of the number. If the number has only two factors, 1 and the number itself only, then it is a prime number. The prime numbers formula helps in generating the prime number or it could be used to test if a given number is prime or not.

**Formula 1**: For any positive integer n,

**(n+1) is prime if and only if n! ≡ n (mod n+1)**

**Formula 2**: A prime number greater than 3 can be represented in the form: 6n ± 1

**Prime number ≡ ± 1 (mod 6)**

This method does not include the numbers that are multiples of prime numbers.

**Formula 3**: Prime numbers greater than 40 can be generated using:

**n ^{2} + n + 41**

### Prime Numbers Formula

The prime numbers formula helps in generating the prime numbers or testing if the given number is prime.

Formula 1: 6n ± 1 where, n = natural number >3

Prime number ** ≡** ± 1 (mod 6)

Example: To check if 541 is prime, divide 541 by 6. The remainder is 1. 541 can be represented as 6(90)+1 and thus 541 is prime.

Formula 2: n^{2} + n + 41 , where n = 0, 1, 2, ….., 39

Example: To generate a random prime number, give values between 0 to 39 to n. Let us key in 5 for n.

We get 5^{2} + 5 + 41 = 71

71 is prime.

## Prime Numbers Formula Rules

Listed below are a few important aspects to be remembered while dealing with prime numbers and their formulas.

- Even numbers placed in the unit's place of any number cannot be a prime number
- The number 2 is the only even prime number.
- For large numbers, add all the digits together if the sum is divisible by 3 then it is not a prime number.
- Except for numbers 2 and 3, all other numbers can be expressed using the prime numbers formula 6n ± 1, where, n = natural number

**Break down tough concepts through simple visuals.**

## Examples Using Prime Numbers Formula

**Example 1: Find if 57 is a prime number.**

**Solution: **

By division method, we find that 1, 3,19, and 57, divide 57 completely without any remainder.

57 has 4 factors. Therefore, 57 is not a prime number since it has more than two factors.

Also, 57 could not be represented in the form of 6n+1 where 'n' = 1,2,3...

Therefore, 57 is not a prime number

**Example 2: Check if 79 is a prime number. **

**Solution: **

By division method, we find that 1, and 79 divide 79 completely without any remainder.

No other number divides 79 completely. Thus, 79 has only 2 factors.

Also, divide 79 by 6. We get the remainder 1.

Thus we can represent it as 6n+1 : 6 × 13 + 1 = 78 + 1 = 79

Therefore, 79 is a prime number.

**Example 3: Check if 19 is a prime number or not using the prime numbers formula. **

**Solution:**

The factors of 19 are 19 and 1.

Let us check if 19 can be represented using the prime numbers formula: 6n + 1

Divide 19 by 6. We get the remainder 1.

We can represent 19 as 6 × 3 + 1

Therefore, 19 is a prime number.

## FAQs on Prime Numbers Formula

### What is Meant by Prime Numbers Formula?

A prime number cannot be factorized because it does not have factors other than 1 and the number itself. The numbers which have more than two factors are called composite numbers. The prime numbers formula helps in representing the general form of a prime number. The formula to test if a number is prime or not is 6n ± 1 (i.e. divide and check if the given number leaves the remainder 1 on dividing by 6) and n^{2} + n + 41 is used to generate a random number, where n can take values from 0 to 39

### What is the Formula to Find the General Form of Prime Numbers?

There are two basic methods with respective formulas to find the prime number of any number. The two methods are:

Method 1 or Formula 1: A prime number can be represented in the form: 6n ± 1

Prime number ** ≡** ± 1 (mod 6)

This method does not include the numbers that are multiples of prime numbers.

Method 2 or Formula 2: Prime numbers greater than 40 can be represented as: n^{2} + n + 41, where n = 0, 1, 2, ….., 39

Method 3: To check if a number is prime or not:

To find if any number is prime or not, do the prime factorization. If the number has only two factors, 1 and the number itself, only then it will be a prime number.

### What are the Basic Rules to Remember While Using Prime Numbers Formula?

The basic rules to remember are:

- Even numbers placed in the unit's place of any number cannot be a prime number.
- The number 2 is the only even prime number
- For large numbers, add all the digits together if the sum is divisible by 3 then it is not a prime number
- Except for numbers 2 and 3, all other numbers can be expressed in the prime numbers formula 6n ± 1, where, n = natural number >3

### Using the Prime Numbers Formula, Find if 43 is a Prime Number or Not.

The factors of 43 are 1 and 43. Using the prime number formula, we can divide it by 6 and the remainder is 1. It can be represented as 6n + 1 (i.e) 6×7 + 1 = 42 + 1 = 43

Therefore, 43 is a prime number.