Write a C Program to find whether number is perfect or not using recursion

By | March 24, 2017

C Program to find number is perfect or not using recursion


Write a C Program to find whether number is perfect or not using recursion. Here’s simple Program to find check whether entered number is perfect or not using recursion in C Programming Language.


Perfect number


A perfect number is a positive number that equals the sum of its divisors, excluding itself. This is also known as its aliquot sum. At this time, it is unknown how many perfect numbers truly exist in our number system.

While we have discovered 48 perfect numbers, the fact that there are an infinite number of prime numbers leads us to believe that there could be an infinite number of perfect numbers.


Perfect number are positive integers n such that

 n=s(n),

where s(n) is the restricted divisor function (i.e., the sum of proper divisors of n), or equivalently

 sigma(n)=2n,

where sigma(n) is the divisor function (i.e., the sum of divisors of n including n itself). For example, the first few perfect numbers are 6, 28, 496, 8128, … (OEIS A000396), since

6 = 1+2+3
28 = 1+2+4+7+14
496 = 1+2+4+8+16+31+62+124+248,

etc.

The nth perfect number is implemented in the Wolfram Language as PerfectNumber[n] and checking to see if k is a perfect number as PerfectNumberQ[k].

The first few perfect number Pn are summarized in the following table together with their corresponding indices p (see below).

n p_n P_n
1 2 6
2 3 28
3 5 496
4 7 8128
5 13 33550336
6 17 8589869056
7 19 137438691328
8 31 2305843008139952128

Below is the source code for C Program to find whether number is perfect or not using recursion which is successfully compiled and run on Windows System to produce desired output as shown below :


SOURCE CODE : :



OUTPUT : :



If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach upto you in the short interval.


Thanks for reading the post….

Leave a Reply