Freitag, 19. Juli 2013

New universal formula for day of week calculation!

I recently developed a new universal formula in the tradition of Gauss and Zeller for day of week calculation!

Solka’s Universal Formula for Day of Week Calculation

W = D + M + Y
Year Offset Y:
Y = [(5*X)7 * (Y int 4*X) + Y4*X + Y4*X int 4 –   
       Y int 100 + Y int 400 – 1]7

W – day of week; Sun=0 … Sat=6
D – day
M – month offset; 0; 3; 3 / 6; 1; 4 / 6; 2; 5 / 0; 3; 5
       for January – December
Y – year offset
Y – year
X – positive integer
lower index – mod

examples
X=100
Y = [4Y int 400 + Y400 + Y400 int 4 – Y int 100 – 1]
X=25
Y = [5Y int 100 + Y100 + Y100 int 4 + Y int 400 – 1]7


X=10
Y = [Y int 40 + Y40 + Y40 int 4 – Y int 100 + Y int 400 – 1]7

August 23, 1994
example X =100
W = (23 + 2 + 5007*1994int400 + 1994400 + 1994400int4 –
         – 1994int100 + 1994int400 - 1)7
     = (25 + 3*1994int400 + 394 + 394int4 - 19 + 4 - 1)7
     = (25 + 3*4 + 394 + 98 – 16)7
     = (25 + 12 + 394 + 98 – 16)7
     = 513/7 ==> 73 remainder 2 ==> Tuesday

August 23, 1994
example X =25
W = (23 + 2 + 1257*1994int100 + 1994100 + 1994100int4 –
         – 1994int100 + 1994int400 - 1)7
     = (25 + 6*1994int100 + 94 + 94int4 - 19 + 4 - 1)7
     = (25 + 6*19 + 94 + 23 – 16)7
     = (25 + 114 + 94 + 23 – 16)7
     = 240/7 ==> 34 remainder 2 ==> Tuesday

August 23, 1994
example X =10
W = (23 + 2 + 507*1994int40 + 199440 + 199440int4 –
        – 1994int100 + 1994int400 - 1)7
     = (25 + 1*1994int40 + 34 + 34int4 – 19 + 4 - 1)7
     = (25 + 3*49 + 34 + 8 – 16)7
     = (25 + 147 + 34 + 8 – 16)7
     = 198/7 ==> 28 remainder 2 ==> Tuesday

A partition of the year into "the century" and "the year in the century" will get:

Y = 100H + E   with   H = Y int 100   and   E=Y100     
Which would correspond to the mathematical form:  
Y = H + E         with   H = [5 H + H int 4 – 1]7   and   E = [E + E int 4]7               

Year in Century Offset E:
E = [(5*X)7 * (E int 4*X) + E4*X + E4*X int 4]7

H – century
E – year in century
H – century offset
E – year in century offset
X – positive integer (1 … 25)

Solka’s Universal Formula corresponds to their special cases …

... Zeller’s Formula
W = (D + 2,6(M + 1) int 1 + E + E int 4 + H int 4 – 2H)7

W – day of week; Sat=0 … Fri=6
D – day
M – month; Mar=3 … Jan=13, Feb=14
E – year in century (adjusted Gregorian date March - February)
H – century

August 23, 1994
W = (23 + 2,6*(8+1)int1 + 94 + 94int4 + 19int4 - 2*19)7
     = (23 + 23,4int1 + 94 + 23,5int1 + 4,75int1 – 38)7
     = (23 + 23 + 94 + 23 + 4 – 38)7
     = 129/7 ==> 18 remainder 3 ==> Tuesday

... Gauss'/Sokolow’s Formula
W = (D + M + 3E + 5E4 - 2H4)7

W – day of week; Sat=0 … Fri=6
D – day
M – month offset; 0; 3; 3 / 6; 1; 4 / 6; 2; 5 / 0; 3; 5 for
       January – December
E – year in century (standard Gregorian date January - December)
H – century

August 23, 1994
W = (23 + 2 + 3 * 94 + 5 * 944 – 2 * 194)7
     = (23 + 2 + 282 + 10 – 6)7
     = 311/7 ==> 44 remainder 3 ==> Tuesday


... X=7 transforms the universal formula into "sun cycle of 28 years" formula 
E = [E28 + E28 int 4]7

 E – year in century offset
E – year in century

... X=3 transforms the universal formula into Lewis' Caroll's formula 
E = [E int 12 + E12 + E12 int 4]7

... X=1 transforms the universal formula into Dioysius’ Exiguus’ classic formula 
E = [E + E int 4]7



Hans-Christian Solka
July 19, 2013
revised
May 17, 2014

Donnerstag, 11. Juli 2013

Universalformel zur Bestimmung der Kennzahl für das Jahr im Jahrhundert



           Fast alle bisher bekannten Methoden, gehen wie die klas­sische Schaltjahr-Methode auf eine universelle Formel zur Er­mitt­lung der Kenn­zahl für das Jahr im Jahrhundert E zurück. Kürzt man die Jahre im Jahr­­hundert um ein Vielfaches X von Vier, kann man die Kennzahl E berechnen:

           E = [(5*X)7 * (E int 4*X) + E4*X + E4*X int 4]7

           Symbole
           E – Kennzahl für Jahr im Jahrhundert                          X – ganze Zahl (1 … 25)
           E – Jahr im Jahrhundert
           Der Index bezieht sich auf die Rechenoperation "mod" bzw. Divisionsrest: 

D.h. (5*X)7 entspricht (5*X)mod7 und E4*X  entspricht Emod(4*X). 

Diese Universalformel habe ich bisher nicht in der Literatur zur Kalenderrechnung gefunden.