You are given the following information, but you may prefer to do some research for yourself.

1 Jan 1900 was a Monday.

Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine.

A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400.

How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?

defis_leap(year): return year % 400 == 0or year % 100 != 0and year % 4 == 0

defcount_days(year, month, day): days = 0 for y in range(1900, year): days += is_leap(y) and366or365 thirties = [4, 6, 9, 11] for m in range(1, month): if m == 2: days += is_leap(year) and29or28 else: days += m in thirties and30or31 return days + day

defmain(): count = 0 for year in range(1901, 2001): for month in range(1, 13): if count_days(year, month, 1) % 7 == 0: count += 1 print count

funccount_days(year, month, day int)int { days := 0 for y := 1900; y < year; y++ { if is_leap(y) { days += 366 } else { days += 365 } } for m := 1; m < month; m++ { if m == 2 { if is_leap(year) { days += 29 } else { days += 28 } } else { if m == 4 || m == 6 || m == 9 || m == 11 { days += 30 } else { days += 31 } } } return days + day }

funcmain() { count := 0 for year := 1901; year < 2001; year++ { for month := 1; month < 13; month++ { if math.Mod(float64(count_days(year, month, 1)), 7) == 0 { count++ } } } fmt.Println(count) }

I’m the 65183rd person to have solved this problem.