How to find whether a given number is prime or not?

  • MHB
  • Thread starter burgess
  • Start date
  • Tags
    Prime
In summary, a prime number is a number that is greater than 1 and has only two factors, 1 and the number itself. To find out if a number is prime, you can follow a simple procedure of finding a whole number nearly greater than the square root of the given number and testing if it is divisible by any prime number less than that number. There are other methods such as those described in the articles from Geeks for Geeks and Wikihow, which can also be used to determine if a number is prime.
  • #1
burgess
25
0
What is a prime number

A number is greater than 1 is called a prime number, if it has only two factors, namely 1 and the number itself.

Prime numbers up to 100 are:2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

Procedure to find out the prime number

Suppose A is given number.

Step 1: Find a whole number nearly greater than the square root of A. K > square root(A)
Step 2: Test whether A is divisible by any prime number less than K. If yes A is not a prime number. If not, A is prime number.

Example:

Find out whether 337 is a prime number or not?

Step 1: 19 > square root (337)
Prime numbers less than 19 are 2, 3, 5, 7, 11, 13, 17
Step 2: 337 is not divisible by any of them

Therefore 337 is a prime number

These are simple and easy tricks which are helpful to solve your math homework problems .
 
Mathematics news on Phys.org
  • #2
Great summary! There are several other ways of determining if a given number is prime in addition to your method.

This article from Geeks for Geeks implements some algorithms in C++, Java, Python, C#, PHP, and Javascript because sometimes when you're developing an application you need to do this.

https://www.geeksforgeeks.org/prime-numbers/

and this article from Wikihow brings in several other schemes including Fermat's Little Theorem and Miller-Rabin test which dramatically speeds up the testing process but have pitfalls in identifying a number as prime when it is not aka false positive.

https://www.wikihow.com/Check-if-a-Number-Is-Prime
 

FAQ: How to find whether a given number is prime or not?

What is a prime number?

A prime number is a positive integer greater than 1 that is only divisible by 1 and itself. In other words, it has exactly two distinct factors.

How can I determine if a number is prime?

One way to determine if a number is prime is to check if it is divisible by any numbers between 2 and its square root. If it is not divisible by any of these numbers, then it is a prime number.

What is the most efficient way to find if a number is prime?

The most efficient way to find if a number is prime is by using the Sieve of Eratosthenes algorithm. This involves creating a list of all numbers between 2 and the given number, and then crossing out all multiples of each number. The numbers that remain are prime numbers.

Can a negative number be prime?

No, a negative number cannot be prime. By definition, a prime number must be a positive integer.

What is the largest known prime number?

As of 2021, the largest known prime number is 2^82,589,933-1, which has over 24 million digits. It was discovered in December 2018 and was named M82589933, after the exponent used to generate it.

Similar threads

Replies
3
Views
809
Replies
3
Views
1K
Replies
24
Views
2K
Replies
5
Views
1K
Replies
7
Views
1K
Replies
19
Views
2K
Replies
2
Views
1K
Replies
2
Views
8K
Back
Top