Input
The input will be a year between 1583 and 2239. We just want to know when Hannukah was or will be in that year. This is information used by millions of people every year and put in calendars across the world. What could be easier?
Output
The Gregorian date of the first evening of Hannukah that year. That is the day before the first full day of Hannukah. Your code should output the month and day of the month in any easy to understand human readable form of your choice.
Examples
1583 December 9
2013 November 27
2014 December 16
2015 December 6
2016 December 24
2017 December 12
2018 December 2
2019 December 22
2020 December 10
2021 November 28
2022 December 18
2023 December 7
2024 December 25
2025 December 14
2026 December 4
2027 December 24
2028 December 12
2029 December 1
2030 December 20
2031 December 9
2032 November 27
2033 December 16
2239 December 21
It could hardly be simpler. We start with a couple of definitions:
We define a new inline notation for the division remainder of \$x\$ when divided by \$y\$: $$(x|y)=x \bmod y$$
For any year Gregorian year \$y\$, the Golden Number, $$G(y) = (y|19) + 1$$ For example, \$G(1996)=2\$ because \$(1996|19)=1\$.
To find \$H(y)\$, the first evening of Hannukah in the year \$y\$, we need to find \$R(y)\$ and \$R(y+1)\$, the day of September where Rosh Hashanah falls in \$y\$ and in \$y+1\$. Note that September \$n\$ where \$n≥31\$ is actually October \$n-30\$.
$$R(y)=⌊N(y)⌋ + P(y)$$ where \$⌊x⌋\$ denotes \$x-(x|1)\$, the integer part of \$x\$, and
$$N(y)= \Bigl \lfloor \frac{y}{100} \Bigr \rfloor - \Bigl \lfloor \frac{y}{400} \Bigr \rfloor - 2 + \frac{765433}{492480}\big(12G(y)|19\big) + \frac{(y|4)}4 - \frac{313y+89081}{98496}$$
We define \$D_y(n)\$ as the day of the week (with Sunday being \$0\$) that September \$n\$ falls on in the year \$y\$. Further, Rosh Hashanah has to be postponed by a number of days which is
$$P(y)=\begin{cases} 1, & \text{if } D_y\big(\lfloor N(y)\rfloor \big)\in\{0,3,5\} & (1)\\ 1, & \text{if } D_y\big(\lfloor N(y)\rfloor\big)=1 \text{ and } (N(y)|1)≥\frac{23269}{25920} \text{ and } \big(12G(y)|19\big)>11 & (2)\\ 2, & \text{if } D_y\big(\lfloor N(y)\rfloor \big)=2 \text{ and } (N(y)|1)≥\frac{1367}{2160} \text{ and } (12G(y)|19)>6 & (3)\\ 0, & \text{otherwise} & (4) \end{cases}$$
For example, in \$y=1996\$, \$G(y)=2\$, so the \$N(y)\approx13.5239\$. However, since September 13 in 1996 was a Friday, by Rule \$(1)\$, we must postpone by \$P(y)=1\$ day, so Rosh Hashanah falls on Saturday, September 14.
Let \$L(y)\$ be the number of days between September \$R(y)\$ in the year \$y\$ and September \$R(y+1)\$ in year \$y+1\$.
The first evening of Hannukah is:
$$ H(y)=\begin{cases} 83\text{ days after }R(y) & \text{if } L(y)\in\{355,385\}\\ 82\text{ days after }R(y) & \text{otherwise} \end{cases} $$
Notes and thanks
Your code may not access the Internet to get the answer using e.g. an online Hebrew calendar calculator.
Thank you to @Adám for pointing me to the rules and for a great deal of help. To keep things simple, this challenge assumes the location to be Jerusalem.
For those now intrigued by the math of the Hebrew calendar, see https://docs.microsoft.com/en-us/dotnet/api/system.globalization.hebrewcalendar?view=netframework-4.8 .