Weird numbers | Rosetta Code | #25
URL to the problem page: http://rosettacode.org/wiki/Weird_numbers In number theory, a weird number is a natural number that is abundant but not semiperfect (and therefore not perfect either). In other words, the sum of the proper divisors of the number (divisors including 1 but not itself) is greater than the number itself (the number is abundant ), but no subset of those divisors sums to the number itself (the number is not semiperfect ). For example: 12 is not a weird number. It is abundant; its proper divisors 1, 2, 3, 4, 6 sum to 16 (which is > 12), but it is semiperfect, eg 6 + 4 + 2 == 12 . 70 is a weird number. It is abundant; its proper divisors 1, 2, 5, 7, 10, 14, 35 sum to 74 (which is > 70), and there is no subset of proper divisors that sum to 70 . Find and display, here on this page, the first 25 weird numbers. #include <iostream> using namespace ...