December 21st, 2018, 07:26 PM  #11 
Math Team Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 13,803 Thanks: 970  
December 21st, 2018, 08:44 PM  #12 
Senior Member Joined: Jul 2012 From: DFW Area Posts: 633 Thanks: 94 Math Focus: Electrical Engineering Applications 
With a program, an average of 3 runs of a million trials each gives: Probability of at least 1: 0.069954 Probability of exactly 1: 0.067655 My (perhaps rough) calculation for the probability of the first stack having all different colors  assuming 56 cards, 8 each of 7 colors, and arranged into a stack of 7 cards (per the OP in post #8 ): $\displaystyle \large \frac{56}{56} \cdot \overbrace{\frac{48}{55}}^{\text{ cards of another color left}} \cdot \frac{40}{54} \cdot \frac{32}{53} \cdot \frac{24}{52} \cdot \frac{16}{51} \cdot \frac{8}{50}\approx 0.00904$ Now the following part definitely is rough, and I trust my program results more, but since there are 8 stacks: $\displaystyle \approx 0.00904 \cdot 8 \approx 0.072$ which is in reasonable agreement with my program. I'm unsure how to get the exact number. Edit: Oops had + instead of \cdot Last edited by jks; December 21st, 2018 at 09:01 PM. 
December 31st, 2018, 12:56 PM  #13 
Newbie Joined: Dec 2018 From: PA Posts: 5 Thanks: 0 
JKS: I got the part you put down with (56/56)*(48/55).... And that works if I'm only making one stack. But once you throw in the 7 other stacks, those top numbers change. But to what, I'm unsure. My reasoning is this. By the time I get back to the first stack, I really don't have 55 cards left. I only have 48...and how many are of a different color from the original card in the first stack is really a variable that will change with each time you put that first card down... I guess I'll have to be content with this "best guess" that you have provided me. It seems like such a high probability, though. Given how many times I've done this (granted, nowhere hear the million your program did three times), I should have had it happen at least once so far.... Thanks for your help! Love and Light, Namaste! Shelly 
December 31st, 2018, 01:34 PM  #14  
Math Team Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 13,803 Thanks: 970  Quote:
56 cards "put in" an array size 56 ? 1st pick at random from 56? Then 56th array element swapped with element picked? 2nd pick at random from 55? ...and similarly afterwards?  
December 31st, 2018, 08:10 PM  #15 
Math Team Joined: Oct 2011 From: Ottawa Ontario, Canada Posts: 13,803 Thanks: 970 
With 1 representing one of the colors, 2 representing another, and so on, then this interesting result (all stacks have the 7 colors) is possible: 1 2 3 4 5 6 7 8 : stacks  1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 However, probability of hitting that result is 1 in zillions!! Happy new year! 
January 1st, 2019, 12:02 PM  #16 
Senior Member Joined: Jul 2012 From: DFW Area Posts: 633 Thanks: 94 Math Focus: Electrical Engineering Applications 
Happy new year indeed! Since I think that I can actually calculate the probability of all of the stacks containing all colors as in the post above, I will reply in reverse order to the posts. I think that the probability is: $\displaystyle \large { \begin{align} & \left (\frac{56}{56} \cdot \frac{48}{55} \cdot \frac{40}{54} \cdot \frac{32}{53} \cdot \frac{24}{52} \cdot \frac{16}{51} \cdot \frac{8}{50} \right ) \\ \cdot & \left (\frac{49}{49} \cdot \frac{42}{48} \cdot \frac{35}{47} \cdot \frac{28}{46} \cdot \frac{21}{45} \cdot \frac{14}{44} \cdot \frac{7}{43} \right ) \\ \cdot & \left (\frac{42}{42} \cdot \frac{36}{41} \cdot \frac{30}{40} \cdot \frac{24}{39} \cdot \frac{18}{38} \cdot \frac{12}{37} \cdot \frac{6}{36} \right ) \\ \cdot & \left (\frac{35}{35} \cdot \frac{30}{34} \cdot \frac{25}{33} \cdot \frac{20}{32} \cdot \frac{15}{31} \cdot \frac{10}{30} \cdot \frac{5}{29} \right ) \\ \cdot & \left (\frac{28}{28} \cdot \frac{24}{27} \cdot \frac{20}{26} \cdot \frac{16}{25} \cdot \frac{12}{24} \cdot \frac{8}{23} \cdot \frac{4}{22} \right ) \\ \cdot & \left (\frac{21}{21} \cdot \frac{18}{20} \cdot \frac{15}{19} \cdot \frac{12}{18} \cdot \frac{9}{17} \cdot \frac{6}{16} \cdot \frac{3}{15} \right ) \\ \cdot & \left (\frac{14}{14} \cdot \frac{12}{13} \cdot \frac{10}{12} \cdot \frac{8}{11} \cdot \frac{6}{10} \cdot \frac{4}{9} \cdot \frac{2}{8} \right ) \\ \cdot & \left (\frac{7}{7} \cdot \frac{6}{6} \cdot \frac{5}{5} \cdot \frac{4}{4} \cdot \frac{3}{3} \cdot \frac{2}{2} \cdot \frac{1}{1} \right ) \\ & = \\ 8^7 & \cdot (7 \cdot 6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1) \\ \cdot 7^7 & \cdot (7 \cdot 6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1) \\ & \vdots \\ \cdot 2^7 & \cdot (7 \cdot 6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1) \\ \cdot 1^7 & \cdot (7 \cdot 6 \cdot 5 \cdot 4 \cdot 3 \cdot 2 \cdot 1) \ / \ 56! \\ & = \frac{(8!)^7(7!)^8}{56!} \approx 1.0 \times 10^{13} \end{align}}$ To check, I simplified to 3 stacks instead of 8 and I calculated the probability as: $\displaystyle \large \frac{(3!)^7(7!)^3}{21!} \approx 0.000701$ I also modified my program to 3 stacks and to check only for all stacks containing all colors. An average of 3 runs of 10 million tries gave an average probability of $\approx 0.000699$ so hopefully the analysis is correct. 
January 1st, 2019, 01:14 PM  #17  
Senior Member Joined: Jul 2012 From: DFW Area Posts: 633 Thanks: 94 Math Focus: Electrical Engineering Applications  Quote:
I pick a random number 055, then add that element to the shuffled array and delete it from the cards array. Then, as you state, I pick another random number from 054, and so on. My code appears below w/o comments but I also attached an image with comments and color coding to make viewing it easier. Some notes about the program (and Ruby):
Here is the code (also see the image): Code: num_tries = 1000000 num_all_colors = 0 letter = 'a' cards_ref = Array.new(8, letter) 6.times do letter = letter.next Array.new(8, letter).each{el cards_ref << el} end num_tries.times do cards = cards_ref.dup shuffled_cards = [] for n in 0..55 rand_ind = rand(56  n) shuffled_cards << cards[rand_ind] cards.delete_at(rand_ind) end stacks = [] 8.times{stacks << []} for n in 0..55 stacks[n/7][n%7] = shuffled_cards[n] # stacks[n%8][n/8] = shuffled_cards[n] end all_colors = false for n in 0..7 if stacks[n].uniq.length == 7 all_colors = true break end end num_all_colors += 1 if all_colors end puts num_tries puts num_all_colors.to_f / num_tries.to_f  
January 1st, 2019, 02:31 PM  #18  
Senior Member Joined: Jul 2012 From: DFW Area Posts: 633 Thanks: 94 Math Focus: Electrical Engineering Applications  Quote:
I share your uncertainty of what the numbers should be and for the recognition of the difficulty of accounting for all of the possibilities as different cards are chosen. That is one of the reasons why I decided to try to program in the first place and come up with a rough calculation later (for at least some measure of checking). Unfortunately, to more precisely calculate the probability, I would have to review some of the probability calculations that I have done in the past (I'm a bit out of practice, and frankly I was never really good at such problems). I am not sure that I will be able to pursue it much further as work starts again tomorrow. However, if I do, I'm sure that I would start by simplifying to 2 or 3 stacks of 7 cards (similar to what I did with the 'all colors in all stacks' post above) and see if I could make some headway there. If I did, I would then try to extend it to 8, but even this may be difficult (I am unsure). Of course, there is no reason why you cannot try this for yourself and if needed ask questions along the way. If I cannot help, there are some pretty sharp members who probably can. Also, for the calculation for a single stack and for the 'all colors in all stacks' I think that you can see that I assumed that the 8 stacks are made one at a time. As romsek pointed out, it should not matter if the stacks are made one at a time or dealt out and built up individually. In my program, I can choose how the stacks are made and it indeed does not seem to matter. So it would be really neat to work the problem both ways and get the same answer, which of course, may be difficult. Finally, how many times have you run the experiment? I modified my program to count how many tries it took to get at least one stack of all colors and the average was ~14.3. Of course, sometimes it took only 1 try, but sometimes it took over 100.  

Tags 
probability 
Thread Tools  
Display Modes  

Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
The probability of this being another probability question  Devans99  Probability and Statistics  4  June 25th, 2018 02:06 PM 
Continuous probability; find probability density function  rivaaa  Advanced Statistics  5  November 5th, 2015 02:51 PM 
probability set theory  probability of x out of n events  hbonstrom  Applied Math  0  November 17th, 2012 08:11 PM 
Joint probability density function, probability  token22  Advanced Statistics  2  April 26th, 2012 04:28 PM 
Probability (probability mass function,pmf)  naspek  Calculus  1  December 15th, 2009 02:18 PM 