中文网: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的最小公倍数