The Magic Cafe Forum Index » » Magical equations » » Calendar Calculation: Year offset question (0 Likes)

 Scott Cram Inner circle 2677 Posts Posted: Nov 4, 2011 07:01 pm    0 I'm trying to find a particular approach to calendar calculation. Maybe it already exists and I just don't know about it, or maybe we'll just have to blaze new territory here. My question concerns the year key, or the year offset. In other words, the question is about the number you use in calendar calculation to adjust for the given year. For any given century, the years ending in 00, 01, 02, 03, 04, 05, and 09 will all always have different year offsets. Since there are 7 different weekdays, these 7 years cover all the offsets. What I'd like to do is find a way to reduce any given year, 00 through 99, to one of the corresponding years above with the same year offset. Obviously, there's one problem right off: If someone choose, say, 55, the corresponding year above would be 04 (because they both have the same year offset), even though 55 isn't a leap year and 04 is a leap year. Conversely, you might go from, say, 80 (a leap year) to 02 (a non-leap year). For the purposes of this question, assume that isn't a problem, and a leap year compensation is made later. The first step that strikes me is to take the year you're given and subtracting 28, 56, or 84 from it, due to the 28-year cycle of year offset numbers. This reduces the problem to dealing with years from 00 to 27. Put mathematically, I'm looking for some function x (or algorithm) that gives the following results (formulas will most likely ignore the leading zeroes, I'm just including them for clarity): f(00) = 00 f(01) = 01 f(02) = 02 f(03) = 03 f(04) = 04 f(05) = 05 f(06) = 00 f(07) = 01 f(08) = 03 f(09) = 09 f(10) = 04 f(11) = 05 f(12) = 01 f(13) = 02 f(14) = 03 f(15) = 09 f(16) = 05 f(17) = 00 f(18) = 01 f(19) = 02 f(20) = 09 f(21) = 04 f(22) = 05 f(23) = 00 f(24) = 02 f(25) = 03 f(26) = 09 f(27) = 04 ...and so on, repeating every 28 years within the same 00-99 range. It's important to note that I'm trying to covert a given year to an equivalent year, not a given year to a year offset number. Grey Matters:Blog|Videos|Mental Gym|Presentation|Store Scott Cram Inner circle 2677 Posts Posted: Nov 4, 2011 11:22 pm    0 So far, I've got the following algorithm, but it's hardly handy for mental arithmetic. It does work every time, however. Starting with the year reduced via modulo 28 to an equivalent year from 00-27: From a leap year: Subtract 5, 11, or 22 (example: 24 - 22 = 02) From an even non-leap year: Subtract 6, 11, or 17 (example: 26 - 17 = 09) 1 year after a leap year: Subtract 11, 17, or 22 (example: 21 - 17 = 04) 1 year before a leap year: Subtract 6, 17, or 23 (example: 19 - 17 = 02) Can anyone simplify this to where it is easier to recall and perform in your head? Grey Matters:Blog|Videos|Mental Gym|Presentation|Store Michael Daniels Inner circle Isle of Man 1503 Posts Posted: Nov 5, 2011 03:24 am    0 I have never been able to devise a quick and simple algorithm for the Year Code, which is why I went with mnemonics for Speed Dating. Mike www.psychicscience.org | Ebooks | Facsimile Book Test hcs Elite user Germany, Magdeburg 450 Posts Posted: Nov 5, 2011 03:25 am    0 I cover this problems in my book Encyclopedia of Weekday Calculation. Send me a pm with your e-mail-adress and you will get the corresponding pages. HCS The book and its contents is available here: http://www.lulu.com/product/hardcover/enzyklop%C3%A4die-der-wochentagsberechnung/18566167? Melencolia I - Magic Squares for the Mental Entertainer * Smart Methods for 4x4, 5x5 and 6x6 Magic Squares * 180 A4-pages * version 3.51 landmark Inner circle within a triangle 5022 Posts Posted: Nov 5, 2011 08:28 am    0 If anyone can do this, or has done this, it's our own stanalger, who has done extensive work on the calendar problem. Perhaps he'll weigh in? Click here to get Gerald Deutsch's Perverse Magic: The First Sixteen Years All proceeds to Open Heart Magic charity. hcs Elite user Germany, Magdeburg 450 Posts Posted: Nov 5, 2011 02:37 pm    0 Quote:On 2011-11-05 09:28, landmark wrote: If anyone can do this, or has done this, it's our own stanalger..Of course he can! He owns my book :=)) (And I cite him :=) with courtesy as great mathmatician.) Melencolia I - Magic Squares for the Mental Entertainer * Smart Methods for 4x4, 5x5 and 6x6 Magic Squares * 180 A4-pages * version 3.51 WilburrUK Veteran user 389 Posts Posted: Nov 5, 2011 02:51 pm    0 Best I can do is: Given the year, get to a number 0-27 (as above) Multiply the result by 5/4 (rounding down to a whole number) Take the remainder of dividing this by 7 Now we need to map the result to the values 0-6 and 9 if the result is 4, use 9 If the result is 4-7 sbtract 1 Code:```
x 5x/4 MOD7 MAP
00 00 00 00
01 01 01 01
02 02 02 02
03 03 03 03
04 05 05 04
05 06 06 05
06 07 07 00
07 08 01 01
08 10 03 03
09 11 04 09
10 12 05 04
11 13 06 05
12 15 01 01
13 16 02 02
14 17 03 03
15 18 04 09
16 20 06 05
17 21 00 00
18 22 01 01
19 23 02 02
20 25 04 09
21 26 05 04
22 27 06 05
23 28 00 00
24 30 02 02
25 31 03 03
26 32 04 09
27 33 05 04