Brainteaser 1568: Back to the future
From The Sunday Times, 27th September 1992 [link]
Many dates, such as my birthday 27th September 1972, are palindromic when written down in the form day/month/year without breaks, my birthday being 2791972.
What about palindromic dates in the millennium beginning on 1st January 2000?
(a) How many palindromic dates will there be in this millennium?
(b) Of these, which two are closest together?
The text above is taken from the book Brainteasers (2002, edited by Victor Bryant), and is different from the originally published puzzle, which is reproduced below:
With another palindromic date occurring on Tuesday (29.9.1992) I am reminded of a Teaser I set last year in which readers were asked to find the longest sequence of consecutive non-palindromic dates in the next 200 years. Here’s another idea:
Assuming the standard numerical format of a date as day.month.year with the year as a four-figure number and with no zeros to start the day or month, find the two palindromic dates in the future which are closest together.
[teaser1568]
Jim Randell 12:44 pm on 9 May 2019 Permalink |
This Python program considers dates from 1-1-2000 to 31-12-2999. It runs in 780ms.
Run: [ @repl.it ]
Solution: (a) There are 323 palindromic dates. (b) The closest pair is: 23-2-2232 and 2-3-2232 (8 days apart).
Pleasingly the number of palindromic dates is itself a palindrome.
If we extend the date range to the year 9999 there are 2107 more palindromic dates (assuming the calendar remains the same). And the closest two are:
And if we extend the current calendar backwards to year 1 we can manage even better:
LikeLike