Post Reply 
RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g)
07-02-2019, 02:21 PM (This post was last modified: 07-02-2019 02:22 PM by DavidM.)
Post: #18
RE: RPL mini-challenge - Triangle of Primes (HP-49G/G+,50g)
Interesting puzzle, interesting approaches!

Code:



Spoiler spoiler...







\<<
   0.
   { DUP 1. n DUP + START NEXTPRIME NEXT }
   'n'
   PICK3
   5. ROLL
   1.
   SEQ
   NIP
\>>

The SEQ command actually builds a UserRPL FOR loop behind the 
scenes. So I'm guessing its performance should be about the same 
as a FOR loop approach (perhaps slightly slower for the overhead 
to build the loop). 

I'll also experiment with some list-based code for this. The 
memory requirements would go up (both for the code and run-time 
needs), but it may perform a little better.
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) - DavidM - 07-02-2019 02:21 PM



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