Post Reply 
(11C) Random Prime Number Generator
10-20-2018, 01:08 PM (This post was last modified: 10-22-2018 10:27 AM by Gamo.)
Post: #1
(11C) Random Prime Number Generator
Program to Generate Random Prime Number.

Procedure: Fix 0

[E] display Prime Number

Example:
This program use Random Number Generator range approximately
from 1000 to 9999 and some time the result will get below 1000.


Below result is randomly difference on each run

[E] display 7247
[E] display 7013
[E] display 5351
[E] display 3209

Program:
Code:

LBL E
RAN#
EEX 4
x
INT
1001
X<>Y
X>Y (Test 7)
GTO 2
GTO E
----------------------------
LBL 2
2 ÷
INT
2 x 1 +
STO 0
3
STO 1
-----------------------------
LBL 4
RCL 0
RCL 1
÷
LSTx
X>Y (Test 7)
GTO 0
X<>Y
INT
LSTx
X=Y (Test 5)
GTO E
2
STO+1
GTO 4
-----------------------------
LBL 0
RCL 0
RTN

Remark: This program will run much faster on the emulator.

Gamo
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



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