The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
(11C) Prime or Not Prime Number
01-20-2018, 01:04 PM (This post was last modified: 01-25-2018 09:33 AM by Gamo.)
Post: #1
(11C) Prime or Not Prime Number
This program check to see if the number is Prime or not Prime number.
Result 0 is Not Prime Number
Result 1 is Prime Numer

Code:

LBL A
STO 1
SQRT
INT
STO 2
1
X=Y? (TEST 5)
RTN
LBL 1
RCL 1
RCL 2
/
FRAC
X=0?
RTN
1
RCL 2
1
-
STO 2
X>Y? (TEST 7)
GTO 1
RTN
R/S

Here is another program to develop the Next Number of Prime.

Code:

LBL B
2
÷
INT
2
x
1
+
STO 0
LBL 5
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 3
2
STO+1
GTO 4
LBL 0
RCL 0
R/S
LBL 3
2
STO+0
GTO5

Example: if the start number is prime the same starting number repeated.

Start 110 B > 113 > Repeat R/S > 127, 131, 137, 139,....

Start 13 B > 13 > Repeat R/S > 17, 19, 23, 29,.....

Large number will compute faster with the modern 15C

Try this number 899,880,277 to start.
Repeat R/S for next prime is 899,880,281 in 2 second using HP-15C Emulator on PC.

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


Messages In This Thread
(11C) Prime or Not Prime Number - Gamo - 01-20-2018 01:04 PM



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