HHC 2014 Programming Contest
|
10-05-2014, 08:02 PM
(This post was last modified: 10-05-2014 08:13 PM by Werner.)
Post: #35
|
|||
|
|||
RE: HHC 2014 Programming Contest
JHM's routine should work if you replace the IFTs by their IF THEN END counterparts:
(untested) Code: \<< Remark that I changed the ultimate test to 1 > This way it will work for 0 and 1, too. I edited my previous post as well. Or else, my own simple concoction. Code: \<< Yet, to speed up the PDP routine, consider the following: If yyyymm01 is prime and the day before isn't, then we have performed a lengthy primality testing for nothing. What we should have is a routine BOTHPRIME? that tests two numbers for divisibility by ever increasing factors at the same time - If both are prime, that will gain us nothing, but if one or both are not, then we will gain a lot of time. I think. How many times does it happen that yyyymm01 is prime and the day before isn't? To be continued.. Werner 41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 14 Guest(s)