Home  >  Java  >  A Program In Java To Identify A Number Is Amicable Or Not

So this project is based on Amicable Number,

In this section, we will learn what is an amicable number and also create Java programs to check whether the given numbers is an amicable number or not.
Note :-The amicable number programs are frequently asked in Java coding tests and academics. So be careful.

What is an Amicable Number ?

Amicable numbers are two different natural numbers related in such a way that the sum of the proper divisors of each is equal to the other number. That is, σ(a)=b and σ(b)=a, where σ(n) is equal to the sum of positive divisors of n (see also divisor function).

The smallest pair of amicable numbers is (220, 284). They are amicable because the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110, of which the sum is 284; and the proper divisors of 284 are 1, 2, 4, 71 and 142, of which the sum is 220. (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.)

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). (sequence A259180 in the OEIS). (Also see OEIS: A002025 and OEIS: A002046) It is unknown if there are infinitely many pairs of amicable numbers.

A pair of amicable numbers constitutes an aliquot sequence of period 2. A related concept is that of a perfect number, which is a number that equals the sum of its own proper divisors, in other words a number which forms an aliquot sequence of period 1. Numbers that are members of an aliquot sequence with period greater than 2 are known as sociable numbers.

(An Information from Wikipedia)

Steps to Find Amicable Number are as follow :-

1. Read or initialize two numbers (N1, N2) from the user.

2. Find the divisor (divOfN1, divOfN2) of both numbers.

3. Find the sum of divisors (sumdiv1, sumdiv2) of both numbers.

4. Check if the sum of divisors of one number is equal to the other number or not.

Java Code

First, Open your Java Code editor / IDE .

Second, See the code given below copy the whole.

Third, Paste in Your IDE


Frequently Asked Questions

Q 1: Can I use this Source Code without giving credits ?

Ans: Yes, you can use but if your bring this projects, then should give us a credit at footer, because it takes alot time make all thess kinds of projects now if you ask that I want to bring it online but I will not give any credits to the developers & the provider then it is very wrong.

Q 2: Actually I want to bring this project online but I don't want to give credits ?

Ans: Ok, we have problem but also you cannot claim that it is made by you.
It is not all about flex you should increase you knowledge.

Q 3: If I am bringing this project online and not giving credits & claiming it is developed by me then ?

Ans: Ok, 1-3 times you will be warned and your that site will be suspended.
Still if you continue, then it can become to a legal things.

3 Comments

Bille

March 19, 2018 at 1:47 pm Reply

Excellent

User_5067

Sep 04, 2018 at 9:50 am Reply

Lmao !!

User_4056

November 09, 2019 at 11:03 pm Reply

Nice

Leave a Comment

Your email address will not be published. Required fields are marked *

Name *
Email *