2011-08-30, 15:55   #5
JohnFullspeed

May 2011
France

7·23 Posts
Find!

The polynome was goof the error was at the line just after.

I make N= N^2 ((an optimization) but it's good only if you begin at one:

Quote:
 Create a list of consecutive integers from 2 to n: (2, 3, 4, ..., n). Initially, let p equal 2, the first prime number. Starting from p, count up in increments of p and mark each of these numbers greater than p itself in the list. These numbers will be 2p, 3p, 4p, etc.; note that some of them may have already been marked. Find the first number greater than p in the list that is not marked; let p now equal this number (which is the next prime). If p is less than n, repeat from step 3. Otherwise, stop.

You can modify

3- Starting from p^2, count up in increments of p and mark each of these numbers greater than p itself in the list. These numbers will be 2p, 3p, 4p, etc.; note that some of them may have already been marked.

not if you make a continue search not a set of continues integers
John