- Related Questions & Answers
- Average numbers in array in C Programming
- Add minimum number to an array so that the sum becomes even in C programming
- Arithmetic Mean in C programming
- C/C++ Program for nth Catalan Number?
- C Program to Check if all digits of a number divide it
- Concatenate a string given number of times in C++ programming
- Write a program to Delete a Tree in C programming
- Write a function that returns 2 for input 1 and returns 1 for 2 in C programming
- Ways to paint N paintings such that adjacent paintings don’t have same colors in C programming
- Surface Area and Volume of Hexagonal Prism in C programming
- Super Prime in c programming
- Sums of ASCII values of each word in a sentence in c programming
- Sum triangle from an array in C programming
- C Programming for sum of the series 0.6, 0.06, 0.006, 0.0006, …to n terms
- C Programming for Sum of sequence 2, 22, 222, ………

The concept of super perfect number is similar to the perfect number. It was found by D Suryanarayana in 1969. He generalized the super perfect number as a number that satisfies the following formula :

sig(sig(n)) = 2n

Here, sig(n) is the function that calculates the sum of divisors of a number, it is also known as divisor summatory function.

The following example with making this concept clear to you :

we need to check if the number N is a superperfect number or not:

N = 16

**Output**

yes

**Explanation** − to check whether a number is a perfect number or not we will find the sum of its divisors.

sig(16) = 1 + 2 + 4 + 8 + 16 = 31 ( divisors of 16 are 1, 2, 4, 8, 16 1, 2, 4, 8, 16) sig( 31) = 1 + 31 = 32( 31 is a prime number) 2*n = 32 = sig(sig(n))

This shows that 16 is a superperfect number.

Now let's see an example of a number which is not a superperfect number.

n = 6 sig(6) = 1 + 2 + 3 + 6= 12 sig(12) = 1 + 2 + 3 + 4 +6 + 12 = 28 6*2 = 12 != 28.

This shows that 6 is not a super perfect number

#include<stdio.h> //function to find the sum of divisors of num int divisorsum(int n){ int sum = 0; // intialising the sum for (int i=1; i*i <= n; ++i){ if (n%i == 0) { // find the sum of divisors if (i == (n/i)) sum += i; else sum += (i + n/i); } } return sum; } int main() { int n = 16; int n1 = divisorsum(n); if(2*n == divisorsum(n1)){ printf("The number %d is a superperfect number", n); } else{ printf("The number %d is not a superperfect number", n); } return 0; }

The number 16 is a super perfect number

Advertisements