Assignment1 Computer
Assignment1 Computer
1. Write a Java program to check whether a given number is a special number. In number
system, special numbers are positive numbers whose only prime factors are 2, 3 or 5.
First few special numbers are 2, 3, 4, 5, 6, 8, 9, 10, 12. Your program should print the
special numbers between two given limits.
2. Write a Java program to PRINT total number of Abundant, Deficient and Perfect
numbers between two given limits
Abundant Number In number theory, an abundant number is a number for which the
sum of its proper divisors is greater than the number itself.
Example :
For ex The integer 12 is the first abundant number. Its proper divisors are 1, 2, 3, 4 and 6
for a total of 16.
Deficient Number : In number theory, an deficient number is a number for which the
sum of its proper divisors is less than the number itself.
For ex The integer 21 is a deficient number. Its proper divisors are 1, 3,7 and for a total
of 11.
Perfect Number: In number system, a perfect number is a positive integer that is equal
to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding
the number itself.
The first perfect number is 6. Its proper divisors are 1, 2, and 3, and 1 + 2 + 3 = 6.
4. Write java program to print numbers between two given limits(L and U) that can be
expressed as the sum of two cubes in two (or more) different ways. (L should be >=1700
and U<= 50000) . The program should print an error message if the lower and upper limit
are out of range.
5. Write a Java program to check if two numbers are Amicable numbers or not. Amicable
numbers are two different numbers so related that the sum of the proper divisors of each
is equal to the other number.
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).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.
6. Write a Java program to check whether a given number is a Disarium number or not. A
Disarium number is a number defined by the following process :
Sum of its digits powered with their respective position is equal to the original number.
For example 175 is a Disarium number :
As 11+72+53 = 175