中文網:https://pe-cn.github.io/
原網址:https://projecteuler.net/
算法弱雞。Hahaha。
前兩天出去玩了,今天多寫兩個好了。
3.
ans = []
n = 600851475143
iter_max = int(n ** 0.5)
for num in range(2,iter_max):
if n%num == 0:
ans.append(num)
n/=num
while n%num == 0:
n/=num
print(ans)
最終答案:
[71, 839, 1471, 6857]
取6857
You are the 468525th person to have solved this problem…
s1 = 0
k1 = 0
for num in range(101):
s1 += num
k1 += num**2
s1 **= 2
s1-k1
numpy寫的話,比較節約。
a = np.linspace(1,100,100)
k = np.sum(a)**2 - np.sum(a*a)
25164150
425385了。
5.這次是1-20的最小公倍數