Inverse Doomsday
|
08-06-2024, 05:00 PM
(This post was last modified: 08-09-2024 01:41 PM by Thomas Klemm.)
Post: #1
|
|||
|
|||
Inverse Doomsday
Recently I came across an old concert poster that took place on Friday, September 4th and wondered what year this was.
After a few tries with the DOW (day of week) function I figured it out pretty quickly. But then I wondered how to solve this problem without brute force. In this specific case, the closest Doomsday is September 5th (i.e. 9/5) which is a Saturday and therefore the anchor day of this year which is coded as 6. For the year's last two digits \(y\) in a certain century, its anchor day can be calculated using the following formula: \(d=\left(k + y+\left\lfloor {\frac {y}{4}}\right\rfloor \right){\bmod {7}}\) The constant \(k\) depends on the century: \(1900–1999\): \(k = 3\) \(2000–2099\): \(k = 2\) We therefore essentially want to invert the following function: \(m=\left(y+\left\lfloor {\frac {y}{4}}\right\rfloor \right){\bmod {7}}\) This function is periodic with a period of \(28 = 4 \times 7\). We will therefore limit ourselves to \(y \in \{0, 1, 2, \cdots, 27\}\) for the time being. The following table can be viewed as a torus. It indicates for each row which \(y\) are mapped to the same value \(m\): \( \begin{array}{|r:r|r|r|r|} \hline & 0 & 1 & 2 & 3 \\\hline 0 & 0 & 17 & 6 & 23 \\\hline 1 & 12 & 1 & 18 & 7 \\\hline 2 & 24 & 13 & 2 & 19 \\\hline 3 & 8 & 25 & 14 & 3 \\\hline 4 & 20 & 9 & 26 & 15 \\\hline 5 & 4 & 21 & 10 & 27 \\\hline 6 & 16 & 5 & 22 & 11 \\\hline \end{array} \) A row is skipped if the year is a leap year, which means it is divisible by \(4\). In my case (i.e. Friday, September 4th in the 20th century) we are looking for values \(y\) that map to \(3 = 6 - 3\). This means that we consider the following line: \( \begin{array}{|r:r|r|r|r|} \hline 3 & 8 & 25 & 14 & 3 \\\hline \end{array} \) Or then in correct order: \(\{3, 8, 14, 25\}\). Once the years are sorted in each row you may notice a common pattern: The differences cycle through the following values: \(\{5, 6, 11, 6\}\) However, they will start with different values. This program is for the HP-42S: Code: 00 { 59-Byte Prgm } Example 3 XEQ "DD↑-1" 3 R/S 8 R/S 14 R/S 25 R/S 31 \(\cdots\) 81 R/S 87 R/S 92 R/S 98 Can you come up with a simpler solution? PS: Due to further constraints, I am convinced that the concert took place in 1992. References |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Inverse Doomsday - Thomas Klemm - 08-06-2024 05:00 PM
RE: Inverse Doomsday - Allen - 08-09-2024, 12:14 AM
RE: Inverse Doomsday - lrdheat - 08-09-2024, 03:28 AM
RE: Inverse Doomsday - RPNerd - 08-09-2024, 03:38 AM
RE: Inverse Doomsday - lrdheat - 08-09-2024, 03:33 AM
RE: Inverse Doomsday - lrdheat - 08-09-2024, 04:04 AM
RE: Inverse Doomsday - Thomas Klemm - 08-09-2024, 01:41 PM
RE: Inverse Doomsday - Thomas Klemm - 08-09-2024, 02:01 PM
RE: Inverse Doomsday - Albert Chan - 08-09-2024, 03:34 PM
RE: Inverse Doomsday - Martin Hepperle - 08-11-2024, 07:17 AM
RE: Inverse Doomsday - Thomas Klemm - 08-09-2024, 05:29 PM
RE: Inverse Doomsday - Albert Chan - 08-10-2024, 02:21 AM
RE: Inverse Doomsday - Albert Chan - 08-10-2024, 12:51 PM
RE: Inverse Doomsday - Thomas Klemm - 08-10-2024, 02:29 PM
RE: Inverse Doomsday - Albert Chan - 08-10-2024, 04:23 PM
|
User(s) browsing this thread: 1 Guest(s)