Post Reply 
RPL second impressions (HP 28)
06-30-2018, 02:37 PM
Post: #31
RE: RPL second impressions (HP 28)
(06-30-2018 07:27 AM)Thomas Klemm Wrote:  
(06-29-2018 07:35 PM)Gerson W. Barbosa Wrote:  Also, your version is faster: 201 seconds for testing 177777773 instead of 214 seconds (on the real 28S).

This variant raises an error when a divisor is found:
Code:
«
  IF DUP 2 MOD
  THEN → n
    «
      IFERR 3 n √
        FOR d
          IF n d MOD NOT
          THEN 0 DOERR
          END
          2
        STEP
      THEN 0
      ELSE 1
      END
    »
  ELSE NOT
  END
»
My hope is that using a FOR-loop is both faster and easier to understand.

Really faster and easier to read: 86 seconds instead of 108 seconds on the 48GX (DOERR doesn’t belong in the 28S catalog).
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) - mdunn - 06-28-2018, 08:48 PM
RE: RPL second impressions (HP 28) - Gerson W. Barbosa - 06-30-2018 02:37 PM
RE: RPL second impressions (HP 28) - ttw - 07-04-2018, 10:52 PM



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