Post Reply 
RPL second impressions (HP 28)
06-27-2018, 07:48 PM
Post: #14
RE: RPL second impressions (HP 28)
(06-27-2018 05:11 PM)mdunn Wrote:  should (...) have local variables, etc.

It's been a while since I wrote an RPL program. I tried to keep it similar to your solution:
Code:
\<<  1
  WHILE 1
  REPEAT
    2 +
    \<< \-> n t
      \<<
        IF n t MOD NOT
        THEN
          n 2 +
          1
        ELSE
          IF t SQ n >
          THEN
            1245 .3 BEEP
            n HALT
            n 2 +
            1
          ELSE
            n t
          END
        END
      \>>
    \>> EVAL
  END
\>>

Here's how your global variables correspond to the local variables:
  • Primes: n
  • TestDiv: t
Still I have the impression we could improve on that.

Quote:(...) should really be two programs

Do you mean like ISPRIME? and NEXTPRIME of the HP 50g?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RPL second impressions (HP 28) - mdunn - 06-27-2018, 01:19 AM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 01:58 PM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 04:06 PM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 05:11 PM
RE: RPL second impressions (HP 28) - mdunn - 06-27-2018, 07:45 PM
RE: RPL second impressions (HP 28) - Thomas Klemm - 06-27-2018 07:48 PM
RE: RPL second impressions (HP 28) - mdunn - 06-28-2018, 08:48 PM
RE: RPL second impressions (HP 28) - ttw - 07-04-2018, 10:52 PM



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