How to Find Prime Numbers ?

Introduction  

How to Find Prime Numbers? It is an important concept in mathematics. A prime number is a whole number greater than 1 that can only be divided by 1 and itself. For example, 2, 3, 5, 7, and 11 are prime numbers, while 4, 6, and 8 are not. Prime numbers play a key role in basic arithmetic and in advanced fields such as cryptography and computer algorithms. In this guide, we will explain what prime numbers are, explore methods to check if a number is prime, and learn how to calculate them. We will also discuss useful formulas, provide solved examples, clear up common misconceptions, and share interesting facts about prime numbers.
 

Table of Contents  

 

What Is a Prime Number?

A prime number is a natural number greater than 1 that has exactly two distinct positive divisors, 1 and itself. All other integers greater than 1 are called composite numbers because they can be divided evenly by more than two numbers. The smallest prime number is 2, which is the only even prime. The next few prime numbers are 3, 5, 7, 11, 13, 17, and 19. Numbers like 1 are not prime since they have only one divisor. Composite numbers include 4 (2×2), 6 (2×3), 8 (2×4), and so on. Recognising what a prime number is helps in solving problems in mathematics and computing.

Prime Numbers Definition

The definition of prime numbers states:  

A prime number p is a natural number greater than 1 whose only positive divisors are 1 and p itself.  

Key consequences of this definition:  

  • There are infinitely many primes, as proved by Euclid.  

  • Every integer greater than 1 has a unique prime factorisation, known as the Fundamental Theorem of Arithmetic.  

  • Primes function as the atoms in arithmetic; every number can be uniquely factored into primes.  

  • This definition lays the groundwork for further study of algorithms, formulas, and applications related to primes.

 

Methods to Check a Prime Number

Method 1: Trial Division

Step 1: Take a number n.

Step 2: Find √n.

Step 3: Divide n by all whole numbers from 2 up to √n.

Step 4: If any number divides evenly, → n is not prime.

Example: Check if 29 is prime.

√29 ≈ 5.38 → check divisibility by 2, 3, 5.

29 ÷ 2 = not whole, 29 ÷ 3 = not whole, 29 ÷ 5 = not whole.

None divides evenly → 29 is prime.


Method 2: Sieve of Eratosthenes

Step 1: Write numbers from 2 to N.

Step 2: Start with 2 (the first prime) → cross out all multiples of 2.

Step 3: Next number not crossed out is 3 → cross out all multiples of 3.

Step 4: Continue the process with 5, 7, etc.

Step 5: The numbers left uncrossed are prime numbers up to N.

Example: Find primes up to 20.

Start: 2,3,4,5,6,…,20

Cross multiples of 2 → 2,3,5,7,9,11,13,15,17,19

Cross multiples of 3 → 2,3,5,7,11,13,17,19

Final primes up to 20: 2, 3, 5, 7, 11, 13, 17, 19

 

Method 3: Primality Tests (for large numbers)

These are used in computers and cryptography.

Fermat’s Little Theorem → If n is prime, then

a^(n−1) ≡ 1 (mod n) for most values of a.

Miller-Rabin Test → A quick test that checks primality with high accuracy.

AKS Test → 100% correct but slower.

Example (Fermat’s Test):

Check if 7 is prime using a = 2.

2^(7−1) = 2^6 = 64.

64 ÷ 7 → remainder = 1.

So, 7 passes Fermat’s test (prime).

 

Method 4: Wilson’s Theorem

Formula:

A number p is prime if →

(p − 1)! ≡ −1 (mod p)

Example: Check if 5 is prime.

(5−1)! = 4! = 24.

24 ÷ 5 → remainder = 4 (which is −1 mod 5).

So, 5 is prime.

 

Misconceptions

  • 1 is a prime number. 

Incorrect: 1 has only one divisor, so it is not prime.

  • All odd numbers are prime. 

Incorrect: Many odd numbers like 9, 15, or 21 are composite.

  • All even numbers (greater than 2) are prime.  

Incorrect: Only 2 is prime; all others are composite.

  • There is the largest prime number.  

Incorrect: Euclid’s proof shows that primes are infinite.

  • Prime numbers can be expressed by a simple formula.  

No universal closed-form formula exists; the ones that do exist are either theoretical or occasionally yield composites.

 

Fun Facts

  • 2 is the only even prime; all others are odd.  

  • Twin primes are pairs like (17,19) or (29,31), which are separated by 2.  

  • Mersenne primes take the form 2ᵖ-1, where p is a prime (e.g., 31, 127).  

  • Goldbach’s conjecture, which remains unproven, suggests that every even number greater than 2 is the sum of two primes.  

  • In cryptography, huge primes (200+ digits) are used in encryption schemes to secure data.

 

Solved Examples

Example 1: Check if 37 is prime

  • Find √37 ≈ 6.08.

  • Test divisibility with primes less than or equal to 6 (that is 2, 3, 5).

    • 37 ÷ 2 = 18.5 → not divisible.

    • 37 ÷ 3 = 12.33 → not divisible.

    • 37 ÷ 5 = 7.4 → not divisible.

  • Since 37 is not divisible by any of these, it is prime.
    Answer: 37 is a prime number.


Example 2: List primes up to 50 using the Sieve of Eratosthenes

  • Write numbers from 2 to 50.

  • Cross out multiples of 2 (except 2).

  • Cross out multiples of 3 (except 3).

  • Cross out multiples of 5 (except 5).

  • Continue this process up to √50 ≈ 7.

  • Numbers left uncrossed are primes.
    Answer: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47.


Example 3: Use Wilson’s Theorem for p = 13

  1. Wilson’s theorem states:
    If (p – 1)! ≡ –1 (mod p), then p is prime.

  2. Here, p = 13 → calculate 12!.

  3. 12! = 479001600.

  4. Divide 479001600 by 13 → remainder = 12.

  5. Since 12 ≡ –1 (mod 13), the condition holds.
    Answer: 13 is a prime number.

 

Example 4: Fermat’s Theorem with n = 1561

  • Fermat’s theorem: If n is prime, then for any a,
    a^(n–1) ≡ 1 (mod n).

  • Take a = 2, n = 1561.

  • Compute 2^1560 mod 1561.

  • Result = 1 → passes Fermat’s test.

  • But 1561 = 17 × 92 → actually composite.
    Answer: 1561 is not prime (Fermat’s method fails here).

 

Example 5: Find primes between 100 and 150 using the segmented sieve

  • Consider numbers from 100 to 150.

  • Mark multiples of small primes (2, 3, 5, 7, 11).

  • Remove numbers divisible by these.

  • The remaining numbers are primes.
    Answer: 101, 103, 107, 109, 113, 127, 131, 137, 139, 149.


Conclusion

Prime numbers are vital in theory and practice, especially in digital security and mathematics. We examined what a prime number is and provided its clear definition. We explored different ways to check if a number is prime, discussed practical methods for calculating prime numbers, and investigated theoretical ideas about prime number formulas. We also looked at common misconceptions, shared interesting facts, and provided solved problems. A better understanding of prime numbers supports critical thinking in science, technology, engineering, and math fields, among others.  

Continue exploring larger primes, implementing prime algorithms, and learning about their role in encryption and number theory. The search for and analysis of prime numbers remains intellectually engaging and practically essential.

  

Frequently Asked Questions on How to Find Prime Numbers

1. What is the formula for finding prime numbers?

Answer: There is no single formula to generate all prime numbers, but methods like the Sieve of Eratosthenes or Wilson’s Theorem help identify them.

 

2. How do I find my prime number?

Answer: To check if a number is prime, divide it by all prime numbers less than or equal to its square root. If it’s divisible only by 1 and itself, it’s prime.

 

3. What is the rule for finding prime numbers?

Answer: A number greater than 1 is prime if it has exactly two factors: 1 and itself. Composite numbers have more than two factors.

 

4. What is the fastest way to calculate prime numbers?

Answer: Use the Sieve of Eratosthenes to efficiently list all prime numbers up to a given limit. For very large numbers, trial division or probabilistic tests are used.

 

Master how to find prime numbers easily with step-by-step tricks,learn now with Orchids The International School!

 

ShareFacebookXLinkedInEmailTelegramPinterestWhatsApp

We are also listed in