HHC 2014 Programming Contest
09-24-2014, 09:31 AM
Post: #2
 Paul Dale Senior Member Posts: 1,653 Joined: Dec 2013
RE: HHC 2014 Programming Contest
As for the three challenge questions at the end.

Spoilers here.

1. The first one is straightforward: a prime triple would require three odd numbered days in a row. Clearly not possible in normal years.

I haven't checked all the myriad of Julian to Gregorian calendar changeovers over the years to see if any of these produced three odd days in a row or not and, if there are some, checked them for primality.

This is obviously possible and should be checked. However, I rather doubt the contest was meant to involve such nastinesses.
2. The second is more interesting. We're going to assume that births are a uniform random process.

To never have a prime birthday, your birthday must either be even or divisible by five. That leaves odd days but not multiples of five.
• Thirty one day months have 13 possible prime days, so 18 never prime ones.
• Thirty day months have 12 possible prime days, so 18 never prime ones.
• Twenty nine day months also have 12 possible prime days, but 17 never prime ones.
• Twenty eight day months have 11 possible prime days and 17 never prime ones.

That the latter two are equal means we don't need to take as much case over leap years. There are 7 * 18 + 4 * 18 + 1 * 17 = 11 * 18 + 17 = 215 never prime days in a year.

So, ignoring leap years the percentage is 215 / 365 * 100 = 58.9%.
Leap years are 58.7%.

Rather than fiddling around with the four, one hundred and four hundred year cycles, I'll round it up to 59%

Baring some arithmetic errors on my part.
3. I've an idea on how to approach this -- look at deltas between dates and prove that either December 31st or January 1st must be divisible by three. The four years would hint that leap years are involved and 366 is divisible by three.

 « Next Oldest | Next Newest »

 Messages In This Thread HHC 2014 Programming Contest - Paul Dale - 09-24-2014, 09:13 AM RE: HHC 2014 Programming Contest - Paul Dale - 09-24-2014 09:31 AM RE: HHC 2014 Programming Contest - Paul Dale - 09-24-2014, 09:41 AM RE: HHC 2014 Programming Contest - Paul Dale - 09-24-2014, 11:46 AM RE: HHC 2014 Programming Contest - David Hayden - 09-24-2014, 12:46 PM RE: HHC 2014 Programming Contest - Paul Dale - 09-24-2014, 09:40 PM RE: HHC 2014 Programming Contest - Joe Horn - 09-24-2014, 03:18 PM RE: HHC 2014 Programming Contest - David Hayden - 09-25-2014, 12:48 AM RE: HHC 2014 Programming Contest - Paul Dale - 09-25-2014, 12:58 AM RE: HHC 2014 Programming Contest - BruceH - 10-02-2014, 09:35 PM RE: HHC 2014 Programming Contest - Paul Dale - 09-24-2014, 09:38 AM RE: HHC 2014 Programming Contest - David Hayden - 09-24-2014, 11:24 AM RE: HHC 2014 Programming Contest - Dave Britten - 09-24-2014, 01:39 PM RE: HHC 2014 Programming Contest - Don Shepherd - 09-24-2014, 01:46 PM RE: HHC 2014 Programming Contest - brouhaha - 09-25-2014, 06:12 AM RE: HHC 2014 Programming Contest - Paul Dale - 09-25-2014, 06:54 AM RE: HHC 2014 Programming Contest - Neil Hamilton - 09-27-2014, 04:47 PM RE: HHC 2014 Programming Contest - Don Shepherd - 09-27-2014, 06:50 PM RE: HHC 2014 Programming Contest - Joe Horn - 09-28-2014, 12:08 AM RE: HHC 2014 Programming Contest - David Hayden - 09-28-2014, 01:39 PM RE: HHC 2014 Programming Contest - Neil Hamilton - 09-29-2014, 11:13 AM RE: HHC 2014 Programming Contest - David Hayden - 09-29-2014, 11:35 AM RE: HHC 2014 Programming Contest - Neil Hamilton - 09-27-2014, 06:56 PM RE: HHC 2014 Programming Contest - Don Shepherd - 09-27-2014, 07:44 PM RE: HHC 2014 Programming Contest - Joe Horn - 09-28-2014, 12:16 AM RE: HHC 2014 Programming Contest - Neil Hamilton - 09-28-2014, 11:58 AM RE: HHC 2014 Programming Contest - Joe Horn - 09-29-2014, 12:43 PM RE: HHC 2014 Programming Contest - Jeff O. - 09-29-2014, 01:41 PM RE: HHC 2014 Programming Contest - Joe Horn - 09-30-2014, 01:20 AM RE: HHC 2014 Programming Contest - Jeff O. - 09-30-2014, 04:39 PM RE: HHC 2014 Programming Contest - Jeff O. - 10-06-2014, 05:01 PM RE: HHC 2014 Programming Contest - Paul Dale - 10-06-2014, 09:34 PM RE: HHC 2014 Programming Contest - Jeff O. - 10-07-2014, 12:26 PM RE: HHC 2014 Programming Contest - Thomas Klemm - 09-29-2014, 04:57 PM RE: HHC 2014 Programming Contest - Neil Hamilton - 09-29-2014, 05:27 PM RE: HHC 2014 Programming Contest - Werner - 10-03-2014, 07:35 AM RE: HHC 2014 Programming Contest - C.Ret - 10-05-2014, 10:02 AM RE: HHC 2014 Programming Contest - Werner - 10-05-2014, 08:02 PM

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