Re: Primes algorithm
From: Tim Smith (reply_in_group_at_mouse-potato.com)
Date: 04/23/05
- Next message: Matt Gutting: "Re: SF: Generalized SFT's"
- Previous message: Rick Decker: "Re: SF: Generalized SFT's"
- In reply to: Lasse: "Re: Primes algorithm"
- Next in thread: Pubkeybreaker: "Re: Primes algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 23 Apr 2005 21:47:54 GMT
In article <1114078111.016810.121960@g14g2000cwa.googlegroups.com>, Lasse
wrote:
> Actually, there is no reason to try N, N+1, N+2 etc.
In fact, testing N, N+1, etc (well, N, N+2, N+4, etc, since there is no need
to consider even numbers!) is not a good idea, as that skews your
distribution. The gaps between primes are not uniform, and testing
sequentially from a random starting point weights each prime by the size of
the gap it ends.
E.g., suppose you have the following for three consecutive primes:
P1, gap of 49 composites, P2, gap of 1 composite, P3
Then "scan from random position" will pick P2 25 times as often as it picks
P3.
-- --Tim Smith
- Next message: Matt Gutting: "Re: SF: Generalized SFT's"
- Previous message: Rick Decker: "Re: SF: Generalized SFT's"
- In reply to: Lasse: "Re: Primes algorithm"
- Next in thread: Pubkeybreaker: "Re: Primes algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
Loading