MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: RE: How do I create a such List?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36197] RE: [mg36133] RE: [mg36126] How do I create a such List?
  • From: "DrBob" <drbob at bigfoot.com>
  • Date: Mon, 26 Aug 2002 04:16:24 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

This was REALLY interesting.  Here's a solution that looks only at the
7,560 relevant combinations.  It first chooses three numerators.  Then
it chooses two denominators for the first fraction.  Then two
denominators for the second fraction.  The last fraction is determined
at that point.

<< DiscreteMath`Combinatorica`
ClearAll[f, g, h, j]
r = Range[1, 9];
f = KSubsets[#1, #2] &;
g[r_List, n_Integer, {}] := f[r, n]
g[r_List, n_Integer, e_?VectorQ] := Join[e, #] & /@ f[Complement[r, e],
n]
g[r_List, n_Integer, e : {__?VectorQ}] := Flatten[g[r, n, #] & /@ e, 1]
h[r_List, e : {__?VectorQ}] := Join[#, Complement[r, #]] & /@ e
j[{a_, b_, c_, d_, e_, f_, g_, h_, i_}] := a/(d e) + b/(f g) + c/(h i)

Timing[Select[h[r, Fold[g[r, #2, #1] &, {}, {3, 2, 2}]], j@# == 1 &]]

{0.532 Second, {{1, 5, 7, 3, 6, 8, 9, 2, 4}}}

Hence the only solution is

1/(3*6)+5/(8*9)+7/(2*4)

Bobby Treat

-----Original Message-----
From: Harvey P. Dale [mailto:hpd1 at nyu.edu] 
To: mathgroup at smc.vnet.net
Subject: [mg36197] [mg36133] RE: [mg36126] How do I create a such List?

Bryan:
	This should do it:
(#[[1]]/( #[[2]]*#[[3]]) +#[[4]]/(#[[5]]*#[[6]])
+#[[7]]/(#[[8]]*#[[9]])) &
/@ Permutations[Range[9]]
	Best,
	Harvey
Harvey P. Dale
University Professor of Philanthropy and the Law
Director, National Center on Philanthropy and the Law
New York University School of Law
Room 206A
110 West 3rd Street
New York, N.Y. 10012-1074

-----Original Message-----
From: timreh719 at yahoo.com.tw [mailto:timreh719 at yahoo.com.tw] 
To: mathgroup at smc.vnet.net
Subject: [mg36197] [mg36133] [mg36126] How do I create a such List?

Hi All:
   I want to solve this math problem: a/(b*c)+d/(e*f)+g/(h*i)=1 where
a,b,c,,,,i are nature numbers range from 1~9 and all is different.
So,I want to create a list which its element are all possible order of
Range[9].
Ex.{{3,4,1,6,5,8,7,9,2},{1,2,5,4,3,7,9,8,6},,,,,,,,,} it has 9!=362880
elements.
    Thanks in advance                                 sincerely   
byran

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________





  • Prev by Date: Re: How to simulate the Doppler Effect ?
  • Next by Date: Re: Re: An interesting math problem
  • Previous by thread: RE: How do I create a such List?
  • Next by thread: CompileEvaluate