Post Reply 
RPL second impressions (HP 28)
07-02-2018, 01:22 AM
Post: #52
RE: RPL second impressions (HP 28)
(07-02-2018 12:05 AM)Gerson W. Barbosa Wrote:  177777773: 65 seconds
999999999989: 97.5 seconds

Awesome! We might still try to speed that up a bit.

Quote:On the HP-28S, HEAD & TAIL replaced with David’s suggestions.

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

Cheers
Thomas
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 - 07-02-2018 01:22 AM
RE: RPL second impressions (HP 28) - ttw - 07-04-2018, 10:52 PM



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