Post Reply 
HHC 2015 RPL Programming Contest
10-07-2015, 04:59 PM (This post was last modified: 10-07-2015 05:00 PM by C.Ret.)
Post: #3
RE: HHC 2015 RPL Programming Contest
Not sure this is the fastest way of doing it.

But it is simple:
Code:
« 1. * DUP SORT ΔLIST SWAP ISPRIME? + 0. POS NOT »

It is the concatenation of the two tests:
A list of distinct numbers:
Code:
« SORT ΔLIST 0. POS NOT »

A list of primes:
Code:
« ISPRIME? 0. POS NOT »

The 1. * is only here to convert the list of exact integer (aka TYPE 28) into regular 'dot' integers (aka TYPE 0). The ISPRIME? function aways returns 0. or 1. 'dot' integer.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2015 RPL Programming Contest - C.Ret - 10-07-2015 04:59 PM



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