Peculiar behaviour of Mathematica code

*To*: mathgroup at smc.vnet.net*Subject*: [mg57929] Peculiar behaviour of Mathematica code*From*: "Tony King" <mathstutoring at ntlworld.com>*Date*: Mon, 13 Jun 2005 05:50:46 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

I have some Mathematica code which I borrowed from the Divisors package. This code should return True if its argument is semiperfect and False if it is not. Here is the code SemiperfectQ[n_Integer?Positive]:=Module[{d=Most[Divisors[n]]}, n==Plus@@#&/@(Or@@Rest[Subsets[d]]) ] This seems to work fine if the argument is composite. However, if the input is prime it returns {False} rather than False. Similarly the code for returning True if a number is weird behaves in the same way WeirdQ[n_Integer?Positive]:=DivisorSigma[1,n]>2n&& n!=Plus@@#&/@(And@@Rest[Subsets[Most[Divisors[n]]]]) Any ideas how these codes could be modified to return False (rather than {False}) for prime inputs Thank you Tony