View Single Post
Old 02-08-2005, 04:31 AM   #8 (permalink)
strcrssd
Insane
 
Location: Rio Grande Valley, Texas
The easiest way to find primes (and one we use for our students) is the Eratosthenes Seive.

Information on it can be found here:
http://ccins.camosun.bc.ca/~jbritton/jberatosthenes.htm

A tip: use a binary array to store the numbers. The index of the array is the number you want to identify as prime/non-prime, and the binary value of array[index] is whether or not the index is prime.
__________________
"I can't understand why people are frightened of new ideas. I'm frightened of the old ones." -- John Cage (1912 - 1992)
strcrssd is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43