lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jan 21, 2011 at 12:59 PM, Joseph Manning <manning@cs.ucc.ie> wrote:
> I simply meant to convey that the overall Sieve of Eratosthenes program
> will be faster if the above loop starts at  k*k  rather than at  k*2 ,
> since it will have fewer iterations to go through.

ah, right.  it was an algorithmic optimization rather than a mechanical one.

i didn't bother to analyze the code; but i certainly found weird to
see 'k*2', since most prime-related algorithms have 'k^2'. (or sqr(x))

-- 
Javier