Here is the 538 Blog Riddle Page For Last Week:

When Will The Arithmetic Anarchists Attack

I started this yesterday and I think I successfully solved the riddle. However I got slightly different answers than the solution published today. I do not know where the error is. Was the solution published in the 538 Blog incorrect? Or is my solution incorrect?

Their solution was that there were 212 events and the longest gap was 1,096 days. Their solution tagged the most events for any one year to be 7 for the year 2012 which did match my solution.

My solution was:

**For Each Date From 01 JAN 2001 to 31 DEC 2099**

**Consider dd/mm/yy where dd*mm == yy**

**Then Answer The Following Questions:**

**[Q1] How Many Of These Events Are There?**

**[A1] There Are 210 Events In the 21st Century.**

**[Q2] Which Year Has The Most?**

**[A2] The Year 2024 Will Have 7 Events.**

**[Q3] What Is The Longest Gap Between Any Two?**

**[A3] The Longest Gap = 1097 Days And Occurs Between 03/19/2057 And 03/20/2060**

I figured this out using a Python script which is given below.

I’m still looking at my code in hopes of finding the problem (assuming it is my problem).

""" When Will The Maths Anarchists Attack For Each Year From 2000-2100: Consider "mm/dd/yy" When mm*dd == yy Then For That (mm, dd, yy) Combination An Attack Will Be Launched [1] How Many Statues Will Be Destoryed? [2] Which Year(s) Will Have The Most Statues Destroyed [3] What Will Be The Longest Gap Between Statue Destruction """ import datetime import calendar class Havoc_From_The_Maths_Anarchists: """ Answer Questions 1,2,3 Above """ def __init__(self): self.list_of_triples = [] self.q1 = "[Q1] How Many Of These Events Are There?" self.q2 = "[Q2] Which Year Has The Most?" self.q3 = "[Q3] What Is The Longest Gap Between Any Two?" self.a1 = "[A1] " self.a2 = "[A2] " self.a3 = "[A3] " def build_list_of_dates(self, debug=True): """ For each month number and each day of the month number When month number times day of the month number is not less than or equal to 99 skip and consider next date If this day of the month is greather than the number of days in this month skip and consier the next date If this year, month, day of the month already found skip and consider the next date Add this year, month, day of the month to the list dates and consider the next date """ self.list_of_triples = [] for idx in range(1,13): for jdx in range(1,32): this_mo = idx this_da = jdx this_yr = this_mo*this_da # SKIP IF YEAR NOT IN RANGE 01 ... 99 if this_yr > 99: continue # SKIP OUT OF RANGE DAYS if this_da > calendar.monthrange(this_yr,this_mo)[1]: if debug: print "[BIG_da] mo = ",this_mo," da = ", this_da, " yr = ",this_yr continue # ADD THIS DAY TO ALLOWED DAYS this_one = (2000+this_yr, this_mo, this_da) if debug: print "[NEW_da] mo = ", this_mo, " da = ", this_da, " yr = ",this_yr self.list_of_triples.append( this_one ) def find_answers(self, debug = True): self.list_of_triples.sort() current_year = 2001 current_list = [] list_of_years = [] list_of_dates = [] for idx in range(0, len(self.list_of_triples)): list_of_dates.append(datetime.date(self.list_of_triples[idx][0],self.list_of_triples[idx][1],self.list_of_triples[idx][2])) if self.list_of_triples[idx][0] != current_year: current_year = self.list_of_triples[idx][0] list_of_years.append(current_list) current_list = [] this_one = datetime.date(self.list_of_triples[idx][0],self.list_of_triples[idx][1],self.list_of_triples[idx][2]) current_list.append(this_one) # Find Answer 1 and Answer 2 total_dates = 0 max_events = 0 max_year = "" for a_list in list_of_years: if debug: for a_date in a_list: print a_date.strftime('%m/%d/%Y'), print this_years_events = len(a_list) total_dates += this_years_events if this_years_events > max_events: max_events = this_years_events max_year = a_list[0].strftime('%m/%d/%Y').split('/')[2] self.a1 += "There Are "+str(total_dates)+" Events In the 21st Century." self.a2 += "The Year "+max_year + " Will Have " + str(max_events) + " Events." # Find Answer 3 date_then = datetime.date(2000,12,31) date_now = date_then delta = int((date_now - date_then).days) max_gap = delta gap_dates = (date_now,date_then) for a_date in list_of_dates: date_then = date_now date_now = a_date delta = int((date_now - date_then).days) if delta > max_gap: max_gap = delta gap_dates = [date_now, date_then] if debug: print "MAX_GAP = " ,max_gap," Occured Between ",gap_dates[1].strftime('%m/%d/%Y')," and ",gap_dates[0].strftime('%m/%d/%Y') self.a3 += "The Longest Gap = "+ str(max_gap)+ " Days And Occurs Between "+gap_dates[1].strftime('%m/%d/%Y')+" And "+gap_dates[0].strftime('%m/%d/%Y') def print_answers(self, debug = True): print print print "For Each Date From 01 JAN 2001 to 31 DEC 2099" print "Consider dd/mm/yy where dd*mm == yy" print "Then Answer The Following Questions:" print print self.q1 print self.a1 print print self.q2 print self.a2 print print self.q3 print self.a3 def main(): answer_questions = Havoc_From_The_Maths_Anarchists() answer_questions.build_list_of_dates(False) answer_questions.find_answers(False) answer_questions.print_answers(False) if __name__ =='__main__':main()<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>