Re: Another binary search time complexity (a fraction of previous subset)
- From: Tim Little <tim@xxxxxxxxxxxxxxxxxx>
- Date: 24 Feb 2011 09:02:11 GMT
On 2011-02-24, pamela fluente <pamelafluente@xxxxxxxxx> wrote:
Now the fact that one could possibly have in ( P(i), P(i+1) ) a
composite which is a product of 2 previous prime, say PA * PB, means
as you say it will not be eliminated until the step where i get to
remove the multiples of the min(PA, PB).
At that point i have done log( min(PA, PB) ) steps (steps are
performed one for each previous prime).
No, since there are about (N/log N) primes less than N, not O(log N).
With the 10^100 example, min(PA, PB) could be quite close to 10^50,
and there are about 10^48 primes to test.
The number of operations grows only very slightly slower than
O(sqrt(N)).
--
Tim
.
- Follow-Ups:
- Re: Another binary search time complexity (a fraction of previous subset)
- From: pamela fluente
- Re: Another binary search time complexity (a fraction of previous subset)
- References:
- Another binary search time complexity (a fraction of previous subset)
- From: pamela fluente
- Re: Another binary search time complexity (a fraction of previous subset)
- From: Tim Little
- Re: Another binary search time complexity (a fraction of previous subset)
- From: pamela fluente
- Re: Another binary search time complexity (a fraction of previous subset)
- From: Tim Little
- Re: Another binary search time complexity (a fraction of previous subset)
- From: pamela fluente
- Another binary search time complexity (a fraction of previous subset)
- Prev by Date: Re: Another binary search time complexity (a fraction of previous subset)
- Next by Date: Re: Another binary search time complexity (a fraction of previous subset)
- Previous by thread: Re: Another binary search time complexity (a fraction of previous subset)
- Next by thread: Re: Another binary search time complexity (a fraction of previous subset)
- Index(es):
Relevant Pages
|