As we know by the definition of perfect numbers that if the sum of the divisors of a number n, then n is called a perfect number.Let n=2m−q×p where p=2m−1 is prime number.Divisor of 2m−1×p are 1,2,22,23,.......2m−1,p,2p,22p,....,2m−2p,2m−1p.
Now we should sum all these divisors except the last one, i,e., 2m−1p
S=(1+2+22+....+2m−1)+p(1+2+22+......+2m−2)
=1(2m−1)2−1+p[1(2m−1−1)]2−1
=2m−1+p(2m−1−1)
=2m+pmm−1−p−1
=2m−1(2+p)−(p+1)
=2m−1(1+2m)−2m[since,p=2m−1]
=2m−1(2m−1)=n