• Please see this website for more info:
  • That depends what you mean by easy. Probably the easiest to describe is to divide all the numbers from 1 to n into your number 'n'. If only 1 and n go exactly, it's prime. That could be a lot of divisions to do, so there are improvements you can make, but each makes the method a little more complicated. For instance, you only need to divide n by prime numbers to test it, so that'll save you some time. Also, you only need to divide numbers up to the square root of n. Then there are increasingly more complex methods. If p^n = p where p is a prime then n is *almost certainly* prime. There are quick ways to do this sum. There are quicker and more reliable (but more complicated) methods still but this answer is too small to contain them.
  • Apart from looking it up on a website. The simplest way to check is to see if it is divisible by any of the prime numbers up to its square root. So for 401 for example, you need to test it with 2,3,5,7,11,13,17,19 So it is therefore a prime. Obviously it helps if you know the prime numbers up to its sqaure root.

Copyright 2017, Wired Ivy, LLC

Answerbag | Terms of Service | Privacy Policy