Post Reply 
challenge - prime numbers where sum of squared digits of prime number is also prime
02-01-2018, 01:54 AM (This post was last modified: 02-01-2018 02:18 AM by Dwight Sturrock.)
Post: #18
challenge - prime numbers where sum of squared digits of prime number is also prime
Program for the HP 12C

88 steps, uses 8 storage registers, must begin with the number 3 in the x register.

Calculates the primes as requested up to 4 places- HP 12C. Program ran for 3min 35 secs to calculate up to 997. Will display the prime sum of the squares followed by the prime from which it is derived.

[/php]


STO 0
SQRT
INTG
STO 1
RCL 0
RCL 1
/
FRAC
X=0
GTO 19
1
STO -1
RCL 1
X<=Y
GTO 17
GTO 05
RCL 0
GTO 23
2
STO +0
RCL 0
GTO 01
EE
3
/
INTG
STO 2
LST x
X<>Y
-
EE
1
*
INTG
STO 3
LST x
X<>Y
-
EE
1
*
INTG
STO 4
LST x
X<>Y
-
EE
1
*
INTG
STO 5
RCL 2 //SQUARE EACH DIGIT AND SUM
2
Y^X
RCL 3
2
Y^X
+
RCL 4
2
Y^X
+
RCL 5
2
Y^X
+
STO 6 //PRIME TEST
SQRT
INTG
STO 1
RCL 6
RCL 1
/
FRAC
X=0
GTO 19
1
STO -1
RCL 1
X<=Y
GTO 83
GTO 71
RCL 6
PSE
RCL 0
PSE
GTO 19
[php]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
challenge - prime numbers where sum of squared digits of prime number is also prime - Dwight Sturrock - 02-01-2018 01:54 AM



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