(11C) Random Prime Number Generator
10-22-2018, 11:03 AM
Post: #22
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
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
 « Next Oldest | Next Newest »

 Messages In This Thread (11C) Random Prime Number Generator - Gamo - 10-20-2018, 01:08 PM RE: (11C) Random Prime Number Generator - Dieter - 10-20-2018, 07:08 PM RE: (11C) Random Prime Number Generator - Gamo - 10-21-2018, 03:22 AM RE: (11C) Random Prime Number Generator - Dieter - 10-21-2018, 05:09 PM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-21-2018, 08:45 AM RE: (11C) Random Prime Number Generator - Dieter - 10-21-2018, 04:41 PM RE: (11C) Random Prime Number Generator - Albert Chan - 10-21-2018, 01:31 PM RE: (11C) Random Prime Number Generator - John Keith - 10-21-2018, 01:52 PM RE: (11C) Random Prime Number Generator - Dieter - 10-22-2018 11:03 AM RE: (11C) Random Prime Number Generator - Dieter - 10-21-2018, 05:20 PM RE: (11C) Random Prime Number Generator - Albert Chan - 10-21-2018, 07:02 PM RE: (11C) Random Prime Number Generator - Albert Chan - 10-22-2018, 01:02 AM RE: (11C) Random Prime Number Generator - Gene - 10-21-2018, 07:47 PM RE: (11C) Random Prime Number Generator - Dieter - 10-21-2018, 09:09 PM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-21-2018, 08:47 PM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-21-2018, 09:03 PM RE: (11C) Random Prime Number Generator - Gene - 10-21-2018, 10:02 PM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-22-2018, 03:46 AM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-22-2018, 04:10 AM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-22-2018, 09:11 AM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-22-2018, 09:22 AM RE: (11C) Random Prime Number Generator - Gamo - 10-22-2018, 10:32 AM RE: (11C) Random Prime Number Generator - Dieter - 10-22-2018, 11:23 AM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-22-2018, 12:28 PM RE: (11C) Random Prime Number Generator - Thomas Klemm - 10-22-2018, 12:31 PM RE: (11C) Random Prime Number Generator - Dieter - 10-22-2018, 06:43 PM

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