John Bibby points out a numeric coincidence – “Sean Connery died on 31/10/20. If you add up all the numbers in the date = 007”. Spooky, huh? I’m hoping you’re asking ‘is that unlikely?’ John asks “How many other dates this year add up to 007? What about in 2021?”
This is a fine pen-and-paper activity (or for thinking about in the shower, as I tried this morning), but also a nice little brute-force coding exercise.
I wrote some code which calculates the digit sum for days in a year from a start date you give it (e.g. 1st January 2020) and outputs:
- a list of dates in the year and their digit sums;
- a list of digit sums and how many dates in the year have this digit sum;
- a bar chart of the digit sums and how many dates in the year have this digit sum.
Given what I’ve said the program does, beware that there are spoilers below. I’d encourage you to have a go, either on paper or in code, before reading on.
Note: the maximum value for the digit sum of a two-digit year is 99. The maximum value for the digit sum of a day is 29. The maximum value for the digit sum of a month is September, 9. Therefore, the maximum digit sum in this form is \(9+9+0+9+2+9=38\).
Anyway, some answers. There are 23 dates with digit sum 7 in 2020 and 18 dates with digit sum 7 in 2021.
My program answers the question more generally than that, though. Charts of the digit sum frequencies for 2020 and 2021 are below.
Python code: date_coincidence_checker on GitHub.
The digit sum is only half the story. We need 007, not 7, and that means two zeros. If we require the date to contain two zeros, the number drops to eight in 2020 and only one in 2021.