You are viewing a single comment's thread. Return to all comments →
#python def s(n): s=1 for x in range(2, int(n**.5)+1): if n %x==0: s+=x+n//x return s n=[int(input()) for x in range(int(input()))] res=set() for x in range(max(n)+1): if x==s(s(x)) and x!=s(x): res.add(x) for _ in n: print(sum(x for x in res if x<=_))
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #21: Amicable numbers
You are viewing a single comment's thread. Return to all comments →