[Date Index]
[Thread Index]
[Author Index]
weird numbers
*To*: mathgroup at smc.vnet.net
*Subject*: [mg132560] weird numbers
*From*: dimanag78 at gmail.com
*Date*: Fri, 11 Apr 2014 02:11:49 -0400 (EDT)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
*Delivered-to*: l-mathgroup@wolfram.com
*Delivered-to*: mathgroup-outx@smc.vnet.net
*Delivered-to*: mathgroup-newsendx@smc.vnet.net
Hello to all.
I found the following problem in a book about Mathematica.
"A weird number is a number such that the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of these divisors sums to to number itself. Find all the weird numbers up to 10000."
Unfortunately, the author does not provide an answer for this problem.
My first attempt.
In[74]:= Timing[
Select[Range[300],
Total[Most[Divisors[#1]]] > #1 && !
MemberQ[Total /@ Subsets[Most[Divisors[#1]]], #1] & ]]
Out[74]= {11.938, {70}}
A result possibly explained by the fact that there are in this range numbers whose proper divisors make more 100000 subsets.
In[75]:= Select[Range[300],
Length[Subsets[Most[Divisors[#1]]]] > 100000 & ]
Out[75]= {180, 240, 252, 288, 300}
Now from number theory we learn that because 6 is a perfect number (its proper divisors sum to the number itself) its multiplies are pseudoperfect numbers and hence no weird.
I use this fact in my second attempt which is much better.
In[76]:= Timing[
Select[Range[300],
Total[Most[Divisors[#1]]] > #1 &&
Mod[#1, 6] != 0 && !
MemberQ[Total /@ Subsets[Most[Divisors[#1]]], #1] & ]]
Out[76]= {0.594, {70}}
Nevertheless, even for numbers up to 2000 there is a big time use.
Table[Timing[{{100*k, 100*(k + 1)},
Select[Range[100*k, 100*(k + 1)],
Total[Most[Divisors[#1]]] > #1 && Mod[#1, 6] != 0 &&
!
MemberQ[Total /@ Subsets[Most[Divisors[#1]]], #1] & ]}], {k,
13, 20}]
{{79.75, {{1300, 1400}, {}}}, {81.406, {{1400,
1500}, {}}}, {103.891, {{1500, 1600}, {}}}, {10.937, {{1600,
1700}, {}}}, {77.438, {{1700, 1800}, {}}}, {83.687, {{1800,
1900}, {}}}, {90.25, {{1900, 2000}, {}}}, {83.969, {{2000,
2100}, {}}}}
My point of view is that the problem asks too much from a simple program.
But I would like to see your thoughts about this issue.
Thank you very much.
Dimitris Anagnostou
Prev by Date:
**Re: How to extract the numerical value of a dynamical variable?**
Next by Date:
**OnError [Thread"::"tdlen"]**
Previous by thread:
**Variable section and hollow Tubes for economic 3D printing**
Next by thread:
**OnError [Thread"::"tdlen"]**
| |