Jump to content

User:Q5968661/sandbox

From Wikipedia, the free encyclopedia

2024年11月12日 03:47

七夕夜咏》 4/4

5||53 65不 酒  3212见  铺  |33 2 1 01 这 此|1·2· 1· 63见 迷 |56 5 656 |1·6 55不 无 65必 |3 – – 123 |23 65不 月 56• •须 有 |1 – – – ||3· 3· 2· 13· ·独 21· ·彷 |6 – – – |2· 2· 1· 63入 16· 梦 |5 – – – ||232 12 3 5 |51 ·花 65落  6 3·23· ·| 2·1· 5 656 | 1· – – – |

All in one table

[edit]
Julian
calendar

700
1400
100
800
1500
200
900
1600
300
1000
1700
400
1100
1800
500
1200
1900
600
1300
2000
Paschal full moon date
Year mod 19
Gregorian
calendar
1700
2100
1800
2200
1900
2300
1600
2000
Gregorian
(1900–2199)
Julian
calendar
00 28 56 84 DC ED FE GF AG BA CB 14 Apr 5 Apr
01 29 57 85 B C D E F G A 3 Apr 25 Mar
02 30 58 86 A B C D E F G 23 Mar 13 Apr
03 31 59 87 G A B C D E F 11 Apr 2 Apr
04 32 60 88 FE GF AG BA CB DC ED 31 Mar 22 Mar
05 33 61 89 D E F G A B C 18 Apr 10 Apr
06 34 62 90 C D E F G A B 8 Apr 30 Mar
07 35 63 91 B C D E F G A 28 Mar 18 Apr
08 36 64 92 AG BA CB DC ED FE GF 16 Apr 7 Apr
09 37 65 93 F G A B C D E 5 Apr 27 Mar
10 38 66 94 E F G A B C D 25 Mar 15 Apr
11 39 67 95 D E F G A B C 13 Apr 4 Apr
12 40 68 96 CB DC ED FE GF AG BA 2 Apr 24 Mar
13 41 69 97 A B C D E F G 22 Mar 12 Apr
14 42 70 98 G A B C D E F 10 Apr 1 Apr
15 43 71 99 F G A B C D E 30 Mar 21 Mar
16 44 72 ED FE GF AG BA CB DC 17 Apr 9 Apr
17 45 73 C D E F G A B 7 Apr 29 Mar
18 46 74 B C D E F G A 27 Mar 17 Apr
19 47 75 A B C D E F G Month
20 48 76 GF AG BA CB DC ED FE
21 49 77 E F G A B C D
22 50 78 D E F G A B C Feb Mar Nov
23 51 79 C D E F G A B Aug
24 52 80 BA CB DC ED FE GF AG Jan May Oct
25 53 81 G A B C D E F Apr Jul
26 54 82 F G A B C D E Sep Dec
27 55 83 E F G A B C D Jun
Day 1 2 3 4 5 6 7 Table of letters for
the days of the year
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

Gauss's algorithm

[edit]

In a handwritten note in a collection of astronomical tables, Carl Friedrich Gauss described a method for calculating the day of the week for 1 January in any given year.[1] He never published it. It was finally included in his collected works in 1927.[2]

Gauss' method was applicable to the Gregorian calendar. He numbered the weekdays from 0 to 6 starting with Sunday. He defined the following operation: The weekday of 1 January in year number A is[1]

or

from which a method for the Julian calendar can be derived

or

where is the remainder after division of y by m,[2] or y modulo m, Y = R(A, 100) and C = (A - Y)/100.

For year number 2000, A - 1 = 1999, Y - 1 = 99 and C = 19, the weekday of 1 January is

The weekday of the last day in year number A - 1 or 0 January in year number A is

The weekday of 0 (a common year) or 1 (a leap year) January in year number A is

Months 11
Jan
12
Feb
1
Mar
2
Apr
3
May
4
Jun
5
Jul
6
Aug
7
Sep
8
Oct
9
Nov
10
Dec
M
Common years 0 3 3 6 1 4 6 2 5 0 3 5 m
Leap years 4 0 2 5 0 3 6 1 4 6
Algorithm

Note: minus 1 if M is 11 or 12 and plus 1 if M less than 11 in a leap year.

The day of the week for any day in year mumber A is

or

where D is the day of the month and A - 1 for Jan or Feb.

The weekdays for 30 April 1777 and 23 February 1855 are

and

This formula was also converted into graphical and tabular methods for calculating any day of the week by Kraitchik and Schwerdtfeger.[2][3]

Disparate variation

[edit]

Another variation of the above algorithm likewise works with no lookup tables. A slight disadvantage is the unusual month and year counting convention. The formula is

where

  • Y is the year minus 1 for January or February, and the year for any other month
  • y is the last 2 digits of Y
  • c is the first 2 digits of Y
  • d is the day of the month (1 to 31)
  • m is the shifted month (March=1,...,February=12)
  • w is the day of week (0=Sunday,...,6=Saturday). If w is negative you have to add 7 to it.

For example, January 1, 2000. (year − 1 for January)

Note: The first is only for a 00 leap year and the second is for any 00 years.

The term ⌊2.6m − 0.2⌋ mod 7 gives the values of months: m

Months m
January 0
February 3
March 2
April 5
May 0
June 3
July 5
August 1
September 4
October 6
November 2
December 4

The term y + ⌊y/4⌋ mod 7 gives the values of years: y

y mod 28 y
01 07 12 18 -- 1
02–13 19 24 2
03 08 14–25 3
-- 09 15 20 26 4
04 10–21 27 5
05 11 16 22 -- 6
06–17 23 00 0

The term c/4⌋ − 2c mod 7 gives the values of centuries: c

c mod 4 c
1 5
2 3
3 1
0 0

Now from the general formula: ; January 1, 2000 can be recalculated as follows:

Lewis Carroll's method

[edit]

Algorithm:[4]

Take the given date in 4 portions, viz. the number of centuries, the number of years over, the month, the day of the month. Compute the following 4 items, adding each, when found, to the total of the previous items. When an item or total exceeds 7, divide by 7, and keep the remainder only.

Century-item: For `Old Style' (which ended 2 September 1752) subtract from 18. For `New Style' (which began 14 September 1752) divide by 4, take overplus from 3, multiply remainder by 2.

Year-item: Add together the number of dozens, the overplus, and the number of 4s in the overplus.

Month-item: If it begins or ends with a vowel, subtract the number, denoting its place in the year, from 10. This, plus its number of days, gives the item for the following month. The item for January is "0"; for February or March, "3"; for December, "12".

Day-item: The total, thus reached, must be corrected, by deducting "1" (first adding 7, if the total be "0"), if the date be January or February in a leap year, remembering that every year, divisible by 4, is a Leap Year, excepting only the century-years, in `New Style', when the number of centuries is not so divisible (e.g. 1800).

The final result gives the day of the week, "0" meaning Sunday, "1" Monday, and so on.

Examples:[4]

1783, September 18

17, divided by 4, leaves "1" over; 1 from 3 gives "2"; twice 2 is "4". 83 is 6 dozen and 11, giving 17; plus 2 gives 19, i.e. (dividing by 7) "5". Total 9, i.e. "2" The item for August is "8 from 10", i.e. "2"; so, for September, it is "2 plus 31", i.e. "5" Total 7, i.e. "0", which goes out. 18 gives "4". Answer, "Thursday".

1676, February 23

16 from 18 gives "2" 76 is 6 dozen and 4, giving 10; plus 1 gives 11, i.e. "4". Total "6" The item for February is "3". Total 9, i.e. "2" 23 gives "2". Total "4" Correction for Leap Year gives "3". Answer, "Wednesday".

ISO week date

[edit]
Julian
centuries
(mod 7)
Gregorian
centuries
(mod 4)
Days of the week Dates
04 11 18 19 23 27 Sun Mon Tue Wed Thu Fri Sat Jan Apri Jul 01 08 15 22 29
03 10 17 Mon Tue Wed Thu Fri Sat Sun Sep Dec 02 09 16 23 30
02 09 16 18 22 26 Tue Wed Thu Fri Sat Sun Mon Jun 03 10 17 24 31
01 08 15 Wed Thu Fri Sat Sun Mon Tue Feb Mar Nov 04 11 18 25
00 07 14 17 2 25 Thu Fri Sat Sun Mon Tue Wed Feb Aug 05 12 19 26
–1 06 13 Fri Sat Sun Mon Tue Wed Thu May 06 13 20 27
–2 05 12 16 20 24 Sat Sun Mon Tue Wed Thu Fri Jan Oct 07 14 21 28
Years 00 01 02 03 04 05
06 07 08 09 10 11
12 13 14 15 16
17 18 19 20 21 22
23 24 25 26 27

Table

[edit]

每年的一月和二月都有四天的週數是固定的。除外以星期四開始的閏年(三月份起週數加一),每個月都有四到五天的週數是固定的(詳見下表)。

月份 日期 週數
01月 04 11 18 25 01–04
02月 01 08 15 22 05–08
03月 01 08 15 22 29 09–13
04月 05 12 19 26 14–17
05月 03 10 17 24 31 18–22
06月 07 14 21 28 23–26
07月 05 12 19 26 27–30
08月 02 09 16 23 30 31–35
09月 06 13 20 27 36–39
10月 04 11 18 25 40–43
11月 01 08 15 22 29 44–48
12月 06 13 20 27 49–52

Table 1

[edit]

主日字母表不僅可以用來查找格里曆(CD)任意一年的主日字母(DL)和任意一天的日字母(dl)及星期(w),而卻可以查找ISO周日曆(WD)的週數(n)及其相應的日期(D),因此可以利用該表來實現這兩種日曆的相互轉換。

位於世紀(c)列和年(y)行交叉處(c, y)的字母就是該年的主日字母(本世紀的主日字母位於A列),而位於日列(d)和月(m)行交叉點(d, m)的字母就是該日的字母,知道了主日字母就可以確定其它日字母的星期。由字母D就可以查到週數固定的日期,當遇到以週四開始的閏年(DC)從三月份起週數加一。

例一查找2032年10月1日的星期及週數:

c = 20,y = 32 mod 28 = 4,d = 1,m = 10;
DL = (2004/04) = DC,dl = (1,10) = A,D = (4,10)(40 + 1);
C = 週日,A = 週五,D = 週一(41);
n = 41 - 1 = 40,w = 5;
WD = 2032–W40–5。

例二查找1980–W40–1的日期:

c = 19,y = 80 mod 28 = 24,n = 40,w = 1 = 週一;
DL = (19,24/24) = FE,D = (4,10);
E = 週日,D = 週六(40),F = (6,10)週一(41) = (-1,10)(29,9)週一(40);
CD = 1980年9月29日週一。
週數 日期 01
08
15
22
29
02
09
16
23
30
03
10
17
24
31
04
11
18
25
--
05
12
19
26
--
06
13
20
27
--
07
14
21
28
--
主日字母星期表
01–04 40–43 01月 10 A B C D E F G 00 06 12 17 23
14–17 27–30 04月 07月 G A B C D E F 01 07 12 18 24
36–39 49–52 09月 12月 F G A B C D E 02 08 13 19 24
23–26 06月 E F G A B C D 03 08 14 20 25
05–08 09–13 44–48 02 03 11月 D E F G A B C 04 09 15 20 26
31–35 08月 C D E F G A B 04 10 16 21 27
18–22 05月 B C D E F G A 05 11 16 22 00
年的前2位數 mod 4 20
00
16
21
01
17
22
02
18
23
03
19
年的後2位
數 mod 28

This table can be used to look up dominical letters (DL), day letters (dl), weekdays (w), week numbers (n), and week dates (W). Letters both in a century column (A C E G) and year rows are dominical letters for years of the century (c, y). Letters both in day columns and a month row are day letters for days of the month (d, m).

  • For 1 October 2032
c = 20, y = 32 mod 28 = 4, d = 1, m = Oct;
DL = (20, 04/04) = DC, dl = (1, Oct) = A, D = 4 Oct;
C = Sun, A = Fri = 5, D = Mon;
n = 40 + 1 - 1 = 40, w = 5;
W = 2032–W40–5.
  • For 1980–W40–1
c = 19, y = 80 mod 28 = 24, n = 40, w = 1 = Mon;
DL = (19, 24/24) = FE, m = Oct, D = 4;
E = Sun, D = Sat = 6;
d = 4 + 1 - 6 = -1 Oct = 29 September 1980.
Week day table for Julian calendar
Date Month Year N Day Mutiple
01 08 15 22 29 Jun 01 07 12 18 1 Mon
02 09 16 23 30 Sep Dec 02 13 19 24 2 Tue
03 10 17 24 31 Apr Jul Jan 03 08 14 25 3 Wed
04 11 18 25 Jan Oct 09 15 20 26 4 Thu
05 12 19 26 May 04 10 21 27 5 Fri
06 13 20 27 Aug Feb 05 11 16 22 6 Sat
07 14 21 28 Feb Mar Nov 06 17 23 28 0 Sun 056 084 112 140 168 196 224 252

Table 2

[edit]
To the day of 13
Jan
14
Feb
3
Mar
4
Apr
5
May
6
Jun
7
Jul
8
Aug
9
Sep
10
Oct
11
Nov
12
Dec
i
Add 000 031(4+3) 059(8+3) 090(12+6) 120(17+1) 151(21+4) 181(25+6) 212(30+2) 243(34+5) 273(39+0) 304(43+3) 334(47+5) 003
Leap year 000 031 060 091 121 152 182 213 244 274 305 335 002
Algorithm od = 30 (m - 1) + floor (0.6 (m + 1)) - i + d
Year's last 2–digit mod 28 (y) 01 02 03 04 05 06
07 08 09 10 11 12
13 14 15 16 17
18 19 20 21 22 23
24 25 26 27 00
Correction (c)
Year's first 2–digit mod 4 (C)
00 00 01 02 03 - 3 - 2 - 1
01 - 2 - 1 00 01 02 03 - 3
02 03 - 3 - 2 - 1 00 01 02
03 01 02 03 - 3 - 2 - 1 00
Algorithm c = (y + floor ((y - 1)/4) + 5 C - 1) mod 7 - 7 if the result > 3

for od and c look up the table above or use the algorithm to calculate. There are 53 weeks in any year (c = 3) or in leap years (c = 2), otherwise there are 52 weeks in a year.

Ceiling the quotient equals the week number and the remainder is the weekday number (0 = Sunday = 7).

For 26 September 2008

ceil ((244 + 26 + 01)/7) = 39
(244 + 26 + 01) mod 7 = 5

the week date is 2008W395.

Summary
Year–starting
on (G/W)
Commom–year
365 − 1 or + 6
Leap–year
366 − 2 or + 5
Mon/01 Jan + 0 − 1 + 0 − 2
Tue/31 Dec + 1 − 2 + 1 − 3
Wed/30 Dec + 2 − 3 + 2 + 3
Thu/29 Dec + 3 + 3 + 3 + 2
Fri/04 Jan − 3 + 2 − 3 + 1
Sat/03 Jan − 2 + 1 − 2 + 0
Sun/02 Jan − 1 + 0 − 1 − 1
  1. ^ a b Gauss, Carl F. (1981). "Den Wochentag des 1. Januar eines Jahres zu finden. Güldene Zahl. Epakte. Ostergrenze.". Werke. herausgegeben von der Königlichen Gesellschaft der Wissenschaften zu Göttingen (2. Nachdruckaufl. ed.). Hildesheim: Georg Olms Verlag. pp. 206–207. ISBN 9783487046433.
  2. ^ a b c Schwerdtfeger, Berndt E. (May 7, 2010). "Gauss' calendar formula for the day of the week" (pdf) (1.4.26 ed.). Retrieved 23 December 2012.
  3. ^ Kraitchik, Maurice (1942). "Chapter five: The calendar". Mathematical recreations (2nd rev. [Dover] ed.). Mineola: Dover Publications. pp. 109–116. ISBN 9780486453583.
  4. ^ a b Dodgson, C.L.(Lewis Carroll). (1887). "To find the day of the week for any given date". Nature, 31 March 1887. Reprinted in Mapping Time, pp. 299-301.