HHC 2015 RPL Programming Contest
|
10-20-2015, 02:18 AM
Post: #6
|
|||
|
|||
RE: HHC 2015 RPL Programming Contest
I worry that your solution won't work if the list contains integers that exceed to precision of real numbers.
I thought of a way to do it without sorting: the list is distinct primes if the least common multiple of the list is the same as the product of the list: Code: « DUP œLIST SWAP @ Put product of list in lvl 2 But this isn't quite right. If the list contains one or more copies of 1, it will incorrectly report that it is distinct primes. My next attempt was faster so I abandoned this. Here's a version that tries to take advantage of the large size of the list. It exits as soon as it finds a duplicate or a non-prime. This takes advantage of DOLIST and error processing for speed, and to get a consistent stack when it's done. Code: « |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HHC 2015 RPL Programming Contest - David Hayden - 10-05-2015, 01:48 PM
RE: HHC 2015 RPL Programming Contest - David Hayden - 10-07-2015, 01:59 PM
RE: HHC 2015 RPL Programming Contest - C.Ret - 10-07-2015, 04:59 PM
RE: HHC 2015 RPL Programming Contest - Joe Horn - 10-08-2015, 04:42 AM
RE: HHC 2015 RPL Programming Contest - C.Ret - 10-08-2015, 03:57 PM
RE: HHC 2015 RPL Programming Contest - David Hayden - 10-20-2015 02:18 AM
RE: HHC 2015 RPL Programming Contest - Claudio L. - 10-20-2015, 01:03 PM
RE: HHC 2015 RPL Programming Contest - Gerald H - 10-20-2015, 02:47 PM
RE: HHC 2015 RPL Programming Contest - Jacob Wall - 10-20-2015, 11:28 PM
RE: HHC 2015 RPL Programming Contest - Werner - 10-21-2015, 07:16 AM
RE: HHC 2015 RPL Programming Contest - Jacob Wall - 10-24-2015, 12:23 AM
|
User(s) browsing this thread: 3 Guest(s)