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

  • Thread starter Thread starter burgess
  • Start date Start date
  • Tags Tags
    Prime
AI Thread Summary
A prime number is defined as a number greater than 1 that has only two factors: 1 and itself. To determine if a number A is prime, first find a whole number K that is greater than the square root of A. Then, test if A is divisible by any prime numbers less than K; if it is, A is not prime. For example, 337 is prime because it is not divisible by any prime numbers less than 19. Additional methods for prime testing include algorithms and the use of the Miller-Rabin test, which can speed up the process but may yield false positives.
burgess
Messages
23
Reaction score
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
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
 
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Thread 'Video on imaginary numbers and some queries'
Hi, I was watching the following video. I found some points confusing. Could you please help me to understand the gaps? Thanks, in advance! Question 1: Around 4:22, the video says the following. So for those mathematicians, negative numbers didn't exist. You could subtract, that is find the difference between two positive quantities, but you couldn't have a negative answer or negative coefficients. Mathematicians were so averse to negative numbers that there was no single quadratic...
Thread 'Unit Circle Double Angle Derivations'
Here I made a terrible mistake of assuming this to be an equilateral triangle and set 2sinx=1 => x=pi/6. Although this did derive the double angle formulas it also led into a terrible mess trying to find all the combinations of sides. I must have been tired and just assumed 6x=180 and 2sinx=1. By that time, I was so mindset that I nearly scolded a person for even saying 90-x. I wonder if this is a case of biased observation that seeks to dis credit me like Jesus of Nazareth since in reality...

Similar threads

Replies
3
Views
999
Replies
24
Views
3K
Replies
7
Views
2K
Replies
19
Views
3K
Replies
2
Views
8K
Back
Top