Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from math import ceil, sqrt
- fsum=0
- def div (n):
- sum=1
- #speed trick, lowest divisor of a pair is always lower than sqrt(n), allows the program to run much faster
- for i in range (2,ceil(sqrt(n)),1):
- if n%i==0:
- sum=sum+i
- sum=sum+(n/i)
- return sum
- def ami(n):
- x=div(n)
- y=div(x)
- if n==y and n!=x:
- return True
- else:
- return False
- for i in range(1,10001,1):
- if ami(i)==True:
- fsum=fsum+i
- print(fsum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement