Post Reply 
(11C) Random Prime Number Generator
10-21-2018, 05:20 PM (This post was last modified: 10-21-2018 05:21 PM by Dieter.)
Post: #9
RE: (11C) Random Prime Number Generator
(10-21-2018 01:31 PM)Albert Chan Wrote:  Trivia: if I am betting for a number (< 10000) with this random prime generator, I'd pick 9587

Closest prime below 9587 is 9551, with a big gap of 36.
All 36 random integers (9552 to 9587) will go for 9587.

With prime table, removing prime gap bias is trivial: pick a random index, then lookup the prime.

To be honest, I have no idea what you want to say here – ?!?
How is this related to this thread's subject?

(10-21-2018 01:31 PM)Albert Chan Wrote:  Update: without prime table, a simple way is keep picking random number until it is prime.
I think Klemm prime-wheel code do this ...

Sure, this also is the idea behind Gamo's original program. Generate an odd random integer (here within the wrong range, though) and check if it's prime. If not, try another one.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(11C) Random Prime Number Generator - Gamo - 10-20-2018, 01:08 PM
RE: (11C) Random Prime Number Generator - Dieter - 10-21-2018 05:20 PM



User(s) browsing this thread: 1 Guest(s)