Post Reply 
HHC 2015 RPL Programming Contest
10-20-2015, 01:03 PM
Post: #7
RE: HHC 2015 RPL Programming Contest
(10-20-2015 02:18 AM)David Hayden Wrote:  I generated a list of the first 250 primes larger than 8000. If finishes this list in 20.65 seconds (on the emulator set at authentic speed). But if I add 88 to the list, it finishes in just 12.13 seconds.

Don't be so afraid to use SORT, the following code:

Code:

<< DUP ISPRIME? * DUP 
IF πLIST THEN
     SORT ΔLIST πLIST NOT NOT
ELSE
     DROP 0.
END
>>

Runs the same list of 250 primes bigger than 8000 on 11.9 seconds on a real 50g. Adding the number 88 at the end does it in 7.2 seconds.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2015 RPL Programming Contest - Claudio L. - 10-20-2015 01:03 PM



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