There exist few magic numbers other than the above introduced 5. They are

You can use the most convenient one. But the year *Y* must be always
larger than the magic number. Therefore the 5 is the most
applicable number for this century.

If the year *Y* was smaller than any magic number, we need to use
the other set of magic numbers (we call it "positive set")

for this century. Using (15), we can obtain the day of the week for the new-year's day with modified algorithm (I use 84 as a magic number for example):

The algorithm is almost the same as (5) and (6), but the last equation (16) is necessary for "positive set". We call the former set (14) "negative set" as contrasted with "positive set". The magic numbers for the other centuries based on UNIX "cal" command are listed in the following table

######## Magic Number table ######## 0, 700,1400: 8+ 13- 36+ 41- 64+ 69- 92+ 97- 100, 800,1500: 20+ 25- 48+ 53- 76+ 81- 200, 900,1600,1800: 4+ 9- 32+ 37- 60+ 65- 88+ 93- 300,1000: 16+ 21- 44+ 49- 72+ 77- 400,1100: 0+ 5- 28+ 33- 56+ 61- 84+ 89- 500,1200: 12+ 17- 40+ 45- 68+ 73- 96+ 600,1300: 1- 24+ 29- 52+ 57- 80+ 85- 1700: 16+ 21- 44+ 49- 64+ 69- 92+ 97- 1900: 5- 28+ 33- 56+ 61- 84+ 89-The symbols "+" or "-" following from numbers stand for it whether the number is included in "positive set" or "negative set".