Program for generating perfect numbers.