J'ai vérifié les nombres premiers de cette année avec python.
def is_prime(n):
if n == 1:
return None
elif n == 2:
return True
elif n >=3 :
num_max = int(math.sqrt(n))
for i in range(2, num_max+1):
if n % i == 0:
return False
return True
import math
year = 2020
for month in range(1,13):
day_max = -1
if month in [2]:
if year % 400 == 0:
day_max = 29
elif year % 100 == 0:
day_max = 28
elif year % 4 == 0:
day_max = 29
else:
day_max = 28
elif month in [4,6,9,11]:
day_max = 30
else:
day_max = 31
for d in range(1,day_max+1):
serial = year * 10000 + month * 100 + d
if is_prime(serial):
print(serial)
20200109 20200111 20200121 20200123 20200223 20200309 20200429 20200511 20200529 20200613 20200619 20200703 20200711 20200721 20200723 20200729 20200801 20200813 20200903 20201021 20201029 20201101 20201113 20201227 20201231
Il semble qu'il y en ait 25 fois cette année.
Recommended Posts