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, e.g.:     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.


Task

Find and display, here on this page, the first 25 weird numbers.



Related tasks

 Abundant, deficient and perfect number classifications
 Proper divisors


See also

 OEIS: A006037 weird numbers
 Wikipedia: weird number
 MathWorld: weird number


  [ stack ]                            is target   (   --> s )
  [ stack ]                            is success  (   --> s )
  [ stack ]                            is makeable (   --> s )
 
  [ bit makeable take
    2dup & 0 != 
    dip [ | makeable put ] ]           is made     ( n --> b )
 
  [ ' [ 0 ] swap
    dup target put
    properdivisors
    0 over witheach +
    target share > not iff
      [ target release
        2drop false ] done
    true success put
    0 makeable put
    witheach
      [ over witheach
         [ over dip
           [ +
             dup target share = iff
               [ false success replace
                 drop conclude ] done
             dup target share < iff
               [ dup made not iff
                   join else drop ]
            else drop ] ]
        success share not if conclude
        drop ]
    drop
    target release
    makeable release
    success take ]                     is weird    ( n --> b )
 
  [] 0
  [ 1+
    dup weird if
      [ tuck join swap ]
    over size 25 = until ]
  drop
  echo