Semi-Perfect/Pseudo Perfect Number in Java
Question : Write a program to accept a number and check whether it is Semi-Perfect number or not.
Semi-Perfect Number : A Semi-Perfect number or Pseudo-Perfect number is a natural number n that is equal to the sum of all or some of its proper divisors.
A Semi-Perfect number that is equal to the sum of all its proper divisors is a perfect number.
First few Semi-Perfect numbers are: 6, 12, 18, 20, 24, 28, 30, 36, 40 etc.
Example :-
Input : 6
Proper Divisors of 6 : 1, 2, 3
Sum of Proper Divisors : 1 + 2 + 3 = 6
Output : Semi-Perfect Number (Since sum of all the factors is equal to the number, it is also a Perfect Number).
Input : 12
Proper Divisors of 12 : 1, 2, 3, 4, 6
Sum of Proper Divisors : 1 + 2 + 3 + 6 = 12
Output : Semi-Perfect Number
Program to check whether a number is Semi-Perfect or not :-
Checkout Source Code : Click here
Program Video : Watch Now
Comentarios