Post Reply 
RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g)
07-01-2019, 11:13 PM (This post was last modified: 07-01-2019 11:55 PM by Didier Lachieze.)
Post: #15
RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g)
(07-01-2019 04:49 AM)Gerson W. Barbosa Wrote:  wp34s version:

001 LBL A
002 INC X
003 # 001
004 # 000
005 STO T
006 X<>Y
007 NEXTP
008 X<>Y
009 DSE X
010 BACK 004
011 x<> T
012 INC X
013 INC X
014 X<>Y
015 PSE 10
016 X<>Y
017 DSE Z
018 BACK 013
019 X<>Y
020 END

Your algorithm is great! Here is a slightly optimized version of the program (24 bytes), removing the unnecessary X<>Y instructions :

001 LBL A
002 c#001
003 <>XYZY
004 NEXTP
005 DSE T
006 BACK 002
007 INC Y
008 INC Y
009 PSE 10
010 DSL Z
011 BACK 008
012 END


EDIT: further optimized by removing the initial INC X with the usage of DSL in step 11.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g) - Didier Lachieze - 07-01-2019 11:13 PM



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