Post Reply 
RPL second impressions (HP 28)
06-30-2018, 07:27 AM (This post was last modified: 06-30-2018 08:46 AM by Thomas Klemm.)
Post: #27
RE: RPL second impressions (HP 28)
(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.
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) - Thomas Klemm - 06-30-2018 07:27 AM
RE: RPL second impressions (HP 28) - ttw - 07-04-2018, 10:52 PM



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