|
|
Scott Cram Inner circle 2678 Posts |
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. |
Scott Cram Inner circle 2678 Posts |
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? |
Michael Daniels Inner circle Isle of Man 1609 Posts |
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 |
hcs Special user Germany, Magdeburg 506 Posts |
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? |
landmark Inner circle within a triangle 5194 Posts |
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 Special user Germany, Magdeburg 506 Posts |
Quote: Of course he can! He owns my book :=))
On 2011-11-05 09:28, landmark wrote: (And I cite him :=) with courtesy as great mathmatician.) |
WilburrUK Veteran user 389 Posts |
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:
<br>x 5x/4 MOD7 MAP <br>00 00 00 00 <br>01 01 01 01 <br>02 02 02 02 <br>03 03 03 03 <br>04 05 05 04 <br>05 06 06 05 <br>06 07 07 00 <br>07 08 01 01 <br>08 10 03 03 <br>09 11 04 09 <br>10 12 05 04 <br>11 13 06 05 <br>12 15 01 01 <br>13 16 02 02 <br>14 17 03 03 <br>15 18 04 09 <br>16 20 06 05 <br>17 21 00 00 <br>18 22 01 01 <br>19 23 02 02 <br>20 25 04 09 <br>21 26 05 04 <br>22 27 06 05 <br>23 28 00 00 <br>24 30 02 02 <br>25 31 03 03 <br>26 32 04 09 <br>27 33 05 04 <br> I think that's right, it kindof makes sense too. |
hcs Special user Germany, Magdeburg 506 Posts |
The quest is to answer for example:
In which years of the 16th century January 16th was a Sunday? Answer 1605 / 1611 / 1622 / 1628 and also 1600 / 1633 / 1639 / 1650 / 1656 / 1661 / 1667 / 1678 / 1684 / 1689 and 1695 You can solve by mental calculation or memorization (see my book). |
WilburrUK Veteran user 389 Posts |
Hcs, I'm sorry to tell you that the answers you gave to your own question are all incorrect.
|
hcs Special user Germany, Magdeburg 506 Posts |
Oh yes, I mean the years in 16xx - the 17th century.
The Gregorian calendar was introduced by pope Gregory XIII in october, 15th 1582 in a few catholic countries. The calendar was adopted in Britain and its colonies in 1752. Because I'm a German I consider the years since 1582, British and Americans since 1752. So I convert my question: In which years in 20xx (21th century) January, 16th was a Sunday? |
stanalger Special user St. Louis, MO 998 Posts |
Quote:
On 2011-11-05 09:28, landmark wrote: I'm getting to this thread a bit late. Seems there's nothing left for me to do. Get Hans-Christian Solka's book. If you can't read German, you've always got google translate at your disposal. When I find some spare time, I'm going to write up an interesting day-of-week calculation method that involves manipulating a packet of cards. Al Stanger |
TomasB Inner circle Sweden 1144 Posts |
Ok, stanalger let the cat out of the bag himself.
His real name is indeed Al Stanger. /Tomas PS The packet av cards thing sounds nothing short of brilliant |
hcs Special user Germany, Magdeburg 506 Posts |
I published a new book entitled "Gregorian calendarsheets 1582 - 2399". The hardcover book is in English.
http://www.lulu.com/product/hardcover/gr......18667311 This book contains Gregorian calendar sheets with weekday, day of month and month for the years 1582 to 2399. The book is a "must have" for mentalists who do the calendar feat. The book enables a 3rd party audience member to prove your answers or to correct a spectator who gave you a wrong day of the week. In the book an easy formula is given for calculating mentally the page corresponding to particular years. So a mentalist can make his response in form of an additional trick. For example "July 4th 1776 was a - Thursday, please prove my answer at page 24 of this book. Page 24 contains the calendar of 1776, is this correct?" |
The Magic Cafe Forum Index » » Magical equations » » Calendar Calculation: Year offset question (0 Likes) |
[ Top of Page ] |
All content & postings Copyright © 2001-2024 Steve Brooks. All Rights Reserved. This page was created in 0.04 seconds requiring 5 database queries. |
The views and comments expressed on The Magic Café are not necessarily those of The Magic Café, Steve Brooks, or Steve Brooks Magic. > Privacy Statement < |