finding amicable numbers with python

Solutions on MaxInterview for finding amicable numbers with python by the best coders in the world

showing results for - "finding amicable numbers with python"
Tim
29 Sep 2016
1x=int(input('Enter number 1: '))
2y=int(input('Enter number 2: '))
3sum1=0
4sum2=0
5for i in range(1,x):
6    if x%i==0:
7        sum1+=i
8for j in range(1,y):
9    if y%j==0:
10        sum2+=j
11if(sum1==y and sum2==x):
12    print('Amicable!')
13else:
14    print('Not Amicable!')