Perfect Number in C Plus Plus

Perfect number is a positive integer that is equal to the sum of its proper positive divisors, the sum of its positive divisors excluding the number itself. It is a number that is half the sum of all of its positive divisors.

For example, the first four perfect numbers are generated by the formula 2p−1(2p − 1), with p a prime number, as follows:

for p = 2:   21(22 − 1) = 6
for p = 3:   22(23 − 1) = 28
for p = 5:   24(25 − 1) = 496
for p = 7:   26(27 − 1) = 8128.

https://www.geekboots.com/cpp/perfect-number


Click here to find Perfect Number with the help of C++

Comments