answersLogoWhite

0

check if 2 divides the Number

check if 3 divides the Number

check if 5 divides the Number

...

check if any prime numbers less than the square root of the Number divide the Number

If any do, the Number is composite; otherwise the Number is prime.

This is called the Sieve of Erasthenes.

An easy way to check if a Prime number divides the Number in base ten (if you don't have a calculator) is to add or subtract 1 or 3 times the prime number to the Number, so that the sum or difference is a multiple of ten (if the prime number isn't 2 or 5). Knock off the zero. If the prime number divides the new number, it also divides the Number; otherwise it doesn't.

User Avatar

Wiki User

14y ago

Still curious? Ask our experts.

Chat with our AI personalities

ProfessorProfessor
I will give you the most educated answer.
Chat with Professor
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

Add your answer:

Earn +20 pts
Q: Algorithm to find whether a number is prime or not?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

What is a method to create a prime number?

No specific method has been discovered so far,not even by the greatest mathematicians,to create a prime number or to find out all the prime numbers......but there's a way to find whether a number is prime or not,i.e,by dividing that number with the first prime nos. such as 2,3,5,7,11 and so on and seeing whether it is exactly divisible or not.If it is not,then it can be classified as a prime no.


How do you find Number of prime numbers below certain number?

You just have to work out it,take each number below it and check whether it is prime or not.


Write a java programme to check whether the number is twin prime or not?

Find a prime number, add 2 to the number. Check if the new number is prime. IE : 3 is prime. 3+2 =5. 5 is prime. (3,5) are twin primes.


Write the algorithm and draw the flowchart to find Sum of N Prime number?

Ah, finding the sum of N prime numbers is a lovely challenge! You can create an algorithm by first defining a function to check if a number is prime, then loop through numbers starting from 2 and add the prime numbers to a running sum until you reach N prime numbers. For the flowchart, you can start with a start/end symbol, then use decision symbols to check if a number is prime, loop symbols to iterate through numbers, and a process symbol to calculate the sum. Remember to add symbols for input and output as well. Happy algorithm painting!


How can i find an algorithm to determine the largest number?

1,000000000000,00000000000000,00000000,000000000000,00000000000,00000000000,00000,0000000000,000000,actually, there is no such thing as 'the largest number'.