Post Reply 
RPL second impressions (HP 28)
07-02-2018, 02:23 AM
Post: #53
RE: RPL second impressions (HP 28)
(07-02-2018 01:22 AM)Thomas Klemm Wrote:  Would the following using a FOR-loop work?

PRIME?
Code:
« → n 
  « 0 n 1 -
    WHILE DUP 2 MOD NOT
    REPEAT
      SWAP 1 +
      SWAP 2 /
    END → s d
    « { 2 13 23 1662803 }
      IFERR 1 4
        FOR i
          DUP i GET s d n COMPOSITE? NOT INV
          DROP
        NEXT
      THEN SWAP DROP
      ELSE DROP 1
      END
    »
  »
»

PS: Just noticed a problem with the list of witnesses: { 2 13 23 1662803 }
They are marked as composite while they are in reality primes.
Let me sleep on that. Smile

Yes, exactly the same running times (and the restrictions you have noticed).

Gerson.
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 - 07-02-2018 02:23 AM
RE: RPL second impressions (HP 28) - ttw - 07-04-2018, 10:52 PM



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