[AI] formula for prime numbers

Kartik Sawhney sawhney.kartik at gmail.com
Thu Sep 2 01:31:15 EDT 2010


Hi,

In order to compute and determine if a large number is
prime/composite, adopt the following method:

For example sake I'll use the number 2,321

1) Find the square root of the number - The Square root of 2,321 is 48.176...

2) remember that if the square root results in an integer it is
automatically composite

3) if your number ends in a 0,2,4,5,6,8 it is NOT PRIME
- 2,321 ends in a 1, so we keep going

4) add up the digits of your number, if the sum is divisible by 3,
your number is composite (basically testing the divisibility of the
number by 3)-2+3+2+1= 8 3 does not go into 8 evenly- onto the next
step

5) Divide the number by all the prime numbers less than the square
root (you can skip 2, 3, and 5)
-since the square root of 2,321 is 48.176..., we need to
try dividing 2,321 by primes less than 48
(7,11,13,17,19,23,29,31,37,41,43,47) since 2,321 is
divisible by 11, it is NOT prime and therefore composite.

6) If a number is not divisible by any of the prime numbers less than
the square, it is PRIME, if it is, it's COMPOSITE.

I hope this will help you.

-Kartik




More information about the AccessIndia mailing list