I want to find Amicable number using Python. Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number. (A proper divisor of a number is a positive factor of that number other than the number itself. For example, the proper divisors of 6 are 1, 2, and 3.) I want to explore 1~20000. So I wrote some codes..
for i in range(1,20000):
a=0
for j in range(1,i):
if i%j==0:
a=a+j
break
for p in range(1,20000):
s=0
for k in range(1,p):
if p%k==0:
s=s+k
break
if s==a and i!=p:
print(i,'amicable',p)
I learn only these things.. 'for', 'while',range...So I want to use them.