RE: Horse Race Puzzle

*To*: mathgroup at smc.vnet.net*Subject*: [mg9183] RE: [mg9162] Horse Race Puzzle*From*: Ersek_Ted%PAX1A at mr.nawcad.navy.mil*Date*: Tue, 21 Oct 1997 02:02:56 -0400*Sender*: owner-wri-mathgroup at wolfram.com

Seth J. Chandler wrote: ---------- |N horses enter a race. Given the possibility of ties, how many different |finishes to the horse race exist. Write a Mathematica program that |shows all the possibilities. | |By way of example: here is the solution (13) by brute force for N=3. The |horses are creatively named a, b and c. The expression {{b,c},a} |denotes a finish in which b and c tie for first and a comes in next. | |{a, b, c}, {a, c, b}, {b, a, c}, {b, c, a}, {c, b, a}, {c, a, b}, |{a,{b,c}}, {{b,c},a}, {b,{a,c}}, |{{a,c},b},{{c,{a,b}},{{a,b},c},{{a,b,c}} | | I propose a different convention. Make a list where we have a list of those in first, a list of those in second, and a list of those in third. This gives the following for three horses: {{a}, {b}, {c}}, {{a}, {c}, {b}}, {{b}, {a}, {c}}, {{b}, {c}, {a}}, {{c}, {b}, {a}}, {{c}, {a}, {b}}, {{a}, {b,c}, {}}, {{b,c}, {a}, {}}, {{b}, {a,c}, {}}, {{a,c}, {b}, {}}, {{c}, {a,b}, {}}, {{a,b}, {c}, {}}, {{a,b,c}, {}, {}} I don't know but this may be easy to do using some of the 230 commands in the package, DisctreteMath`CombinatorialFunctions`. See Mathematica 3.0 Standard Packages (pp 83-102). Apparently an even better guide to the package is the following book: Implementing Discrete Mathematics: Combinatorics and Graph Theory with Mathematica, by Steven Skiena On the other hand you could write the code yourself if you want to take on the challenge. However, I don't have the time to pursue this any further right now. Ted Ersek