Twitterで面白いtweetを見つけたので確かめてみました。
2013 =3×11×61, #2014 =2×19×53 & 2015 =5×13×31: 3 consecutive years each the product of 3 distinct primes - won't happen again until 2665-7!
— Simon Pampena (@mathemaniac) 2013, 12月 31
def solve2014():
i = 2
while i<10000:
list = [primeFactorize(i), primeFactorize(i+1), primeFactorize(i+2)]
if len(list[0])==3 and len(list[1])==3 and len(list[2])==3:
checked = []
for j in range(3):
for k in list[j]:
if not(k in checked):
checked.append(k)
if len(checked)==9:
print("i=",i,primeFactorize(i),primeFactorize(i+1),primeFactorize(i+2))
i=i+1
def primeFactorize(num):
list = []
t = num
i = 2
if num <= 1:
return [0]
else :
while i<=t:
if t%i==0:
list.append(i)
t=t/i
else:
i=i+1
return list
if __name__ == "__main__":
solve2014()
実行結果
i= 1309 [7, 11, 17] [2, 5, 131] [3, 19, 23]
i= 1885 [5, 13, 29] [2, 23, 41] [3, 17, 37]
i= 2013 [3, 11, 61] [2, 19, 53] [5, 13, 31]
i= 2665 [5, 13, 41] [2, 31, 43] [3, 7, 127]
i= 3729 [3, 11, 113] [2, 5, 373] [7, 13, 41]
i= 5133 [3, 29, 59] [2, 17, 151] [5, 13, 79]
i= 6061 [11, 19, 29] [2, 7, 433] [3, 43, 47]
i= 6213 [3, 19, 109] [2, 13, 239] [5, 11, 113]
i= 6305 [5, 13, 97] [2, 3, 1051] [7, 17, 53]
i= 6477 [3, 17, 127] [2, 41, 79] [11, 19, 31]
i= 6853 [7, 11, 89] [2, 23, 149] [3, 5, 457]
i= 6985 [5, 11, 127] [2, 7, 499] [3, 17, 137]
i= 7257 [3, 41, 59] [2, 19, 191] [7, 17, 61]
i= 7953 [3, 11, 241] [2, 41, 97] [5, 37, 43]
i= 8393 [7, 11, 109] [2, 3, 1399] [5, 23, 73]
i= 8533 [7, 23, 53] [2, 17, 251] [3, 5, 569]
i= 8785 [5, 7, 251] [2, 23, 191] [3, 29, 101]
i= 9213 [3, 37, 83] [2, 17, 271] [5, 19, 97]
i= 9453 [3, 23, 137] [2, 29, 163] [5, 31, 61]
i= 9821 [7, 23, 61] [2, 3, 1637] [11, 19, 47]
i= 9877 [7, 17, 83] [2, 11, 449] [3, 37, 89]