Java Example Programs – How to write a java program to check Amicable Numbers

Hey, in this post we will learn about Amicable Number and we will learn also that how to write a java program to check Amicable Number.

Amicable numbers come in a pair. So whenever we write an Amicable number we write them in a pair. The smallest Amicable Number pair is (220, 284).
Let’s understand what is an amicable number.  Amicable numbers are two different numbers so related that the sum of the proper divisors of each is equal to the other number.
For 220 the proper divisors are 1, 2 ,4, 5, 10, 11, 20, 22, 44, 55 and 110
And For 284  the proper divisors are 1, 2, 4, 71 and142 .

let’s make a sum of 220 proper divisors :  1+2 + 4 + 5 + 10+ 11 + 20 + 22 + 44 + 55  = 284 .
And the sum of 284 proper divisors : 1 + 2 + 4 + 71 +142 = 220 .

More Explanation in a picture that will help you to understand more
amicable number presentation

So let’s write a java program to check Amicable Numbers.

Sample Output:

The first ten amicable pairs are:

(220, 284), (1184, 1210), (2620, 2924), (5020, 5564), (6232, 6368),
(10744, 10856), (12285, 14595), (17296, 18416), (63020, 76084)  and (66928, 66992).

I hope you have learned about Amicable Numbers and you also learned that how to write a java program to check the numbers are amicable or not. Keep Learning best wishes to you.

Thank you so much for being here. We appreciate your presence. Inspire us to do more by comment’s or share this knowledge for who wants to learn.

Leave a Reply

avatar
  Subscribe  
Notify of