+ 1
How the magic numbers for months (622503514624) to calculate day of the week for a given date, is calculated?
5 Respostas
+ 4
Basant, don't know if this helps, but maybe it is related:
http://ludism.org/mentat/CalendarFeat
+ 3
Please delete the other post.
+ 1
Seemed that you post this question twice?
+ 1
Sorry, network issue! Now fixed.
0
in Gregorian calendar months in non-leap year have
31,28,31,30,31,30,31,31,30,31,30,31 days (lengths of months in days)
if we apply mod 7 on these value we get
3,0,3,2,3,2,3,3,2,3,2,3
if table starts with some offset(anchor value)
here=6
and for consecutive values we add the value (aka odd days) for current month to the previous value we get
6,6+3,6+3+0,6+3+0+3,6+3+0+3+2,etc. we get
6,9,9,12,14 etc. and lastly we apply mod 7
=(6 + ODD DAYS FROM THE BEGINNING OF THE YEAR=1.JANUARY TO THE 1. OF THE GIVEN MONTH) MOD 7
& we get
6,2,2,5,0, etc.
for a leap year we should substract 1 from first two entries , so
62|2503514624 would be magic numbers for non-leap year and
51|2503514624 would be magic numbers for leap year