Re: SF: Back to theory
From: Mike Kent (mkent_at_acm.org)
Date: 02/27/05
- Next message: William Elliot: "Re: abstract algebra"
- Previous message: Brian VanPelt: "Re: abstract algebra"
- In reply to: Tim Peters: "Re: SF: Back to theory"
- Next in thread: Tim Peters: "Re: SF: Back to theory"
- Reply: Tim Peters: "Re: SF: Back to theory"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 27 Feb 2005 01:09:29 -0500
Tim Peters wrote:
...
> I want to elaborate on that, because some results _may_ be artifacts of the
> way primes are chosen. I pick an N-bit prime like so: pick a random
> integer i uniformly from the range 2**(N-1) <= i < 2**N, and then find the
> smallest prime >= i. But not all primes in range are equally likely to get
> picked -- due to the way I'm choosing them, the probability of picking a
> particular prime p is proportional to 1 + the number of composites
> immediately preceding p. I can't imagine why that would bias the results,
> but can't swear that it doesn't. Another thing to test, anyway.
I believe you can get rid of (much of) the bias by modifying your
procedure as follows:
Pick a fixed number K with 0 < K < N.
Pick i between 2**(N-1) and 2**N as before. Make a
list of the primes between i and i+K. If the list is
empty, pick a new i and repeat; otherwise randomly
pick an item from the list.
Picking K = 0 gets rid of all the bias -- the modified procedure
them amounts to pick i, see if it's prime. K = 1 is almost as
good since only one of i and i+1 is even. As K gets larger, bias
arises against primes that occur in clusters (the items of a prime
pair are roughly 1/2 as likely to be picked as is a prime with
not near prime neighbors, for instance); as K decreases, the
expected number of iterations increases.
- Next message: William Elliot: "Re: abstract algebra"
- Previous message: Brian VanPelt: "Re: abstract algebra"
- In reply to: Tim Peters: "Re: SF: Back to theory"
- Next in thread: Tim Peters: "Re: SF: Back to theory"
- Reply: Tim Peters: "Re: SF: Back to theory"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|