MathGroup Archive 2002

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

Search the Archive

Re: How do I create a such List?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg36131] Re: [mg36126] How do I create a such List?
  • From: BobHanlon at aol.com
  • Date: Fri, 23 Aug 2002 00:25:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 8/22/02 4:54:44 AM, timreh719 at yahoo.com.tw writes:

>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.

The list is just the permutations
 given by Permutations[Range[9]]. 
The members of this list that satisfy the equation are

sol1 = Select[Permutations[Range[9]],
 
      #[[1]]/(#[[2]]*#[[3]]) +
 
            #[[4]]/(#[[5]]*#[[6]]) +
 
            #[[7]]/(#[[8]]*#[[9]]) == 1&];

Length[sol1]

48

However, every solution is repeated six times since this includes the 
permutations of three groups of the form x/(y*z).

sol2 = Union[Partition[#,3]& /@ sol1,
 
      SameTest->(Sort[#1]==Sort[#2]&)];

Length[sol2]

8

These eight are the same solution since in each of the three groups, the 
form x/(y*z) is equivalent to x/(z*y).  Consequently, there is only one 
unique solution. 

First[sol2]

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

Plus@@((#[[1]]/(#[[2]]*#[[3]]))& /@ %)

1


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Silly Mathematica button question
  • Next by Date: Notebook Manipulation
  • Previous by thread: Re: How do I create a such List?
  • Next by thread: RE: How do I create a such List?