Re: As the Crow flies.
- From: Ernest Major <{$to$}@meden.demon.co.uk>
- Date: Thu, 9 Oct 2008 08:17:06 +0100
In message <83b7f9ca-051b-4f3d-90e0-b3c54cd7e846@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, spintronic <spintronic@xxxxxxxxxxx> writes
On Oct 8, 6:41 pm, Ernest Major <{$t...@xxxxxxxxxxxxxxxxx> wrote:Are you counting demonstrating that 2, 3 and 5 are prime in that figure? [1] (Since you object to taking the primes < 1000 from a table, you should also object to taking the primes < 6 as precalculated.)In message
<673323fe-7960-465e-879e-a95ef0539...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Dwib <dwibd...@xxxxxxxxx> writes
>On Oct 8, 11:33 am, spintronic <spintro...@xxxxxxxxxxx> wrote:
>> Quickest algorithm to find all primes below (N).
>> For usenet. (N) = 1000.
>> Please give your working out.
>> And more importantly the number of calculations you use.
>> The winner gets to kiss my ass, when I present mine.
>MatLab has a pretty cool algorithm. Roughly speaking it is:
>1) They create an array of integers from 1 to N.
>2) For each integer, i, from 2 to root-N (I think), they "zero" every
>i-th element.
>3) What's left over are the prime numbers.
In the Sieve of Erastothenes the second step is
2) For each prime number (i.e.number not struck out by previous passes)
from 2 to root(N).
Wikipedia gives a more efficient algorithm - the Sieve of Atkin.
>Pretty cool!
>Dwib
--
alias Ernest Major- Hide quoted text -
- Show quoted text -
Am I correct in thinking that for PI(1000) this takes 301 calculations?
Apart from that, your question, like your original post to this thread, is ill-posed. The number of calculations is implementation dependent; it also depends on what is defined as a calculation. (How many calculations did you assign to the calculation of floor(root(1000))?)
Also, why did you pick such a tidgy number for measurement of speed? - an algorithm that is faster for PI(1000) might be left behind in the dust for PI(1000000000).
--
alias Ernest Major
.
- Follow-Ups:
- Re: As the Crow flies.
- From: spintronic
- Re: As the Crow flies.
- References:
- As the Crow flies.
- From: spintronic
- Re: As the Crow flies.
- From: Dwib
- Re: As the Crow flies.
- From: Ernest Major
- Re: As the Crow flies.
- From: spintronic
- As the Crow flies.
- Prev by Date: Re: Atheists support evolution because evolution supports their
- Next by Date: Re: Atheists support evolution because evolution supports their
- Previous by thread: Re: As the Crow flies.
- Next by thread: Re: As the Crow flies.
- Index(es):
Relevant Pages
|