Post Reply 
challenge - prime numbers where sum of squared digits of prime number is also prime
01-09-2018, 08:07 PM
Post: #16
challenge - prime numbers where sum of squared digits of prime number is also prime
.
Hi, Mike

(01-08-2018 09:55 PM)Mike (Stgt) Wrote:  
(01-08-2018 07:43 PM)Valentin Albillo Wrote:  This 109-byte, 3-liner will print all elements up to a given limit:

1 INPUT Z @ N=2 @ LOOP @ N=FPRIM(N+1) @ IF N>Z THEN DISP @ END ELSE M=N @ S=0
2 REPEAT @ S=S+MOD(M,10)^2 @ M=M DIV 10 @ UNTIL NOT M @ IF NOT PRIM(S) THEN DISP N;
3 END LOOP

Sorry, I get an ERR L1:Unordered at clause IF N>Z THEN DISP @

Your N and/or Z variables are presently declared as COMPLEX. Execute a DESTROY ALL statement and rerun my program.

Quote:IMHO, if N>Z we're done.

Of course we are, that's why my routine next does a DISP to close the ongoing output line, then does an END to actually end execution.

Regards.
V.
.

  
All My Articles & other Materials here:  Valentin Albillo's HP Collection
 
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread



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