Post Reply 
Find number property and write RPL program (HP-49G,G+, HP 50g)
09-24-2014, 07:23 PM
Post: #15
RE: Find number property and write RPL program (HP-49G,G+, HP 50g)
Of course, the first "ISPRIME?" isn't really necessary since all the primes are generated by using the "NEXTPRIME" command.

So here is a shorter and therefore faster version:
Code:
%%HP: T(3)A(R)F(.);
\<< \-> n
  \<< { } 0 2
    WHILE OVER n <
    REPEAT DUP 2 * 1 +
      IF ISPRIME?
      THEN SWAP 1 + SWAP ROT OVER + UNROT
      END
      NEXTPRIME
    END DROP2
  \>>
\>>
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Find number property and write RPL program (HP-49G,G+, HP 50g) - Thomas Ritschel - 09-24-2014 07:23 PM



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