Post Reply 
(11C) Random Prime Number Generator
10-22-2018, 11:03 AM
Post: #22
RE: (11C) Random Prime Number Generator
(10-21-2018 01:52 PM)John Keith Wrote:  
(10-21-2018 01:31 PM)Albert Chan Wrote:  (* Mathematica: primes below 10000 (1229 in total), all equally likely *)

Prime[Random[Integer, {1, 1229}]]

Or on the HP Prime (pun intended):

ithprime(rand(1229)+1)

Albert and John: the target is generating primes between 1000 and 9999. So the lowest index is 169 (for 1009) and the highest is 1229 (for 9973). I don't use Mathematica or the Prime, but I think you will know the correct syntax for a random index between 169 and 1229 (inclusively).

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-22-2018 11:03 AM



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