# Thread: what going on....continued

1. ## what going on....continued

now how would we go about eliminating every third number as well, and continue with every 5, 7, 11, etc. numbers, to be left with all of the prime numbers. We figured out how to eliminate the evens, but we have to go on from there, and print out only the prime numbers.
i.e., start with #'s 1-100, eliminate multiple of 2, the 3, then 5, then 7, until we are left with only the prime numbers from 1 to (n).

IF YOU HAVE NO IDEA WHAT I'M TALKING ABOUT, PLEASE READ THE THREAD TITLED:
whats going onm

thank you

2. if the goal is to print out only the nodes that have prime numbers stored as data or only nodes whose sequence number is prime, then why not just create a function to check if a number is prime, then search the list from top to bottom evaluating the appropriate "number" for "primeness", and if it's prime print it out, if not move on to the next node. The elimination process seems fraught with problems.

3. the algorithm you are using to find primes is called the sieve of erastophenes(sp some old greek geezer). Look it up on google and you will find many examples.

Popular pages Recent additions