HHC 2018 Programming Contests
|
10-01-2018, 06:40 AM
(This post was last modified: 10-01-2018 09:14 PM by Thomas Klemm.)
Post: #46
|
|||
|
|||
RE: HHC 2018 Programming Contests
For each period \(p \in {23, 28, 33}\) we're looking for values such that
\(\sin(2 \pi \tfrac{k}{p})\approx \pm 1\) This leads to the following result: \( \begin{matrix} p=23 :& k \in \{6, 17\} \\ p=28 :& k \in \{7, 21\} \\ p=33 :& k \in \{8, 25\} \end{matrix} \) For each pair \((23, 28)\), \((23, 33)\) and \((28, 33)\) the "extrema dates" are calculated separately with the help of the Chinese remainder theorem which states that for numbers \(p\) and \(q\) that are coprime there's a ring isomorphism: \(\mathbb{Z}_{p}\times\mathbb{Z}_{q}\cong\mathbb{Z}_{p\cdot q}\). In the end the minimum of these three values is chosen. \(\mathbb{Z}_{23}\times\mathbb{Z}_{28}\cong\mathbb{Z}_{644}\) We're looking for a number \(n\) such that \((n \bmod 23, n \bmod 28) = (1, 0)\). Clearly \(n\) must be a multiple of \(28\): \(n = 28 \cdot k\). But then \(n \bmod 23 \equiv 5\cdot k\) and we can guess \(k=14\) since \(5 \cdot 14 = 70 = 1 + 3 \cdot 23 \equiv 1\ (\bmod 23)\). Thus we end up with: \(n = 28 \cdot 14 = 392 \equiv 1\ (\bmod 23)\). Similarly we can find a number \(m\) such that \((m \bmod 23, m \bmod 28) = (0, 1)\): \(m = 23 \cdot 11 = 253 = 1 + 9 \cdot 28 \equiv 1\ (\mod 28)\) Thus \((1, 0) \simeq 392\) and \((0, 1) \simeq 253\) form a basis in \(\mathbb{Z}_{23} \times \mathbb{Z}_{28}\). For \(a, b \in \mathbb{N}\) we find that: \((a, b) \simeq a \cdot 392 + b \cdot 253\ (\bmod 644)\) This leads to the following table: \( \begin{matrix} (6, 7) &\simeq& 6 \cdot 392 &+& 7 \cdot 253 &=& 4123 &\equiv& 259\ (\bmod\ 644) \\ (6, 21) &\simeq& 6 \cdot 392 &+& 21 \cdot 253 &=& 7665 &\equiv& 581\ (\bmod\ 644) \\ (17, 7) &\simeq& 17 \cdot 392 &+& 7 \cdot 253 &=& 8435 &\equiv& 63\ (\bmod\ 644) \\ (17, 21) &\simeq& 17 \cdot 392 &+& 21 \cdot 253 &=& 11977 &\equiv& 385\ (\bmod\ 644) \end{matrix} \) This explains the magic numbers in these lines of the program: Code: 07 63 ; (17, 7) \(\mathbb{Z}_{23}\times\mathbb{Z}_{33}\cong\mathbb{Z}_{759}\) As above we can find a basis using \((1, 0) \simeq 231\) and \((0, 1) \simeq 529\). We end up with this table: \( \begin{matrix} (6, 8) &\simeq& 6 \cdot 231 &+& 8 \cdot 529 &=& 5618 &\equiv& 305\ (\bmod\ 759) \\ (6, 25) &\simeq& 6 \cdot 231 &+& 25 \cdot 529 &=& 14611 &\equiv& 190\ (\bmod\ 759) \\ (17, 8) &\simeq& 17 \cdot 231 &+& 8 \cdot 529 &=& 8159 &\equiv& 569\ (\bmod\ 759) \\ (17, 25) &\simeq& 17 \cdot 231 &+& 25 \cdot 529 &=& 17152 &\equiv& 454\ (\bmod\ 759) \end{matrix} \) These are magic numbers of the program: Code: 29 190 ; (6, 25) \(\mathbb{Z}_{28}\times\mathbb{Z}_{33}\cong\mathbb{Z}_{924}\) As above we can find a basis using \((1, 0) \simeq 561\) and \((0, 1) \simeq 364\). We end up with this table: \( \begin{matrix} (7, 8) &\simeq& 7 \cdot 561 &+& 8 \cdot 364 &=& 6839 &\equiv& 371\ (\bmod\ 924) \\ (7, 25) &\simeq& 7 \cdot 561 &+& 25 \cdot 364 &=& 13027 &\equiv& 91\ (\bmod\ 924) \\ (21, 8) &\simeq& 21 \cdot 561 &+& 8 \cdot 364 &=& 14693 &\equiv& 833\ (\bmod\ 924) \\ (21, 25) &\simeq& 21 \cdot 561 &+& 25 \cdot 364 &=& 20881 &\equiv& 553\ (\bmod\ 924) \end{matrix} \) These are the magic numbers of the program: Code: 55 91 ; (7, 25) Here's the program for the HP-41CX: Code: 01▸LBL "NED" ; birthday Examples: The date-format DMY is used. 27.021963 XEQ "NED" NED: 14.11.2018 23: -100 28: -100 33: -76 01.011905 XEQ "NED" NED: 10.10.2018 23: -100 28: 62 33: 100 28.092018 XEQ "NED" NED: 30.11.2018 23: -100 28: 100 33: -54 Thanks for the challenge Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)