# Amicable numbers

I have came across the concept amicable numbers while reading a book and i wanted to write a code to find one in the range from 1 to 500 and due to me not coding for a while i used if statement and for loop because they are basic concepts that are easy to remember ,and i was able to find the numbers by checking the results , my question is how can i alter on / improve the code so that it will be able to find amicable numbers and return them in the result https://code.sololearn.com/cSqzLyxXqNWU/?ref=app

7/10/2022 10:10:41 AM

dareen moughrabi7 Answers

New Answerdareen moughrabi continue is used to skip current iteration So if the sum of factor is equal to the number then we are avoiding to check factor of that new sum sum is a sum of factors of i sum1 is a sum of factors of sum So if i and sum1 are same means 220 and sum of factor of 284(sum of factor of i (220)) then printing that numbers.

A͢J thx for attempting to help I have run the code and it almost works perfectly yet there are additional results which do not work as amicable numbers The sum of the factors of 28 Is 28 And the sum of the factors of 6 is 6 And 496 is 496