Fork me on GitHub

一则新闻引发的思考(20200202千年一遇对称日 厦门可正常办结婚登记)

 

第一直觉,有点不信,为啥是千年一遇的对称日,废话不多说,代码来验证!

 

month_day = {'01': 31, '02': 28, '03':31, '04':30, '05':31, '06':30, '07':31, '08':31, '09':30, '10':31, '11':30, '12':31}   

all_m_d = []
for mon, days in month_day.items():
    for day in range(1, days+1):
        temp = str(mon) + '{:0>2}'.format(str(day))
        all_m_d.append(temp)
        
for i in range(1949, 3000):
    year = str(i)
    if year[::-1] in all_m_d:
        print(year+year[::-1])
    

  

 

 结果如下:  


20011002
20100102
20111102
20200202
20211202
20300302
20400402
20500502
20600602
20700702
20800802
20900902
21011012
21100112
21111112
21200212
21211212
21300312
21400412
21500512
21600612
21700712
21800812
21900912
22011022
22100122
22111122
22200222
22211222
22300322
22400422
22500522
22600622
22700722
22800822
22900922
View Code

 

观察后发现,千年对称日??明年就有好吧(20211202)!

 

再猜测:是不是 两个数字组成的对称日,千年才有一次?

 

验证如下:

 

month_day = {'01': 31, '02': 28, '03':31, '04':30, '05':31, '06':30, '07':31, '08':31, '09':30, '10':31, '11':30, '12':31}   

all_m_d = []
for mon, days in month_day.items():
    for day in range(1, days+1):
        temp = str(mon) + '{:0>2}'.format(str(day))
        all_m_d.append(temp)
        
for i in range(1949, 5000):
    year = str(i)
    if year[::-1] in all_m_d:
        y_m_d = year+year[::-1]
        if len(set(y_m_d)) == 2:
            print(y_m_d)
  

 

 

结果如下:

20200202
21111112
21211212
22111122
22200222
22211222
30300303
31111113
40400404
41111114

 

2111 - 2020 =‬ 91

也不是!!这才隔了91年!


总结:
面对媒体的言论,要保持理智清醒的头脑!

谢谢看官,溜了溜了
posted @ 2020-01-10 21:26  暮良文王  阅读(1180)  评论(5编辑  收藏  举报