Jump to content

Welcome to BrainDen.com - Brain Teasers Forum

Welcome to BrainDen.com - Brain Teasers Forum. Like most online communities you must register to post in our community, but don't worry this is a simple free process. To be a part of BrainDen Forums you may create a new account or sign in if you already have an account.
As a member you could start new topics, reply to others, subscribe to topics/forums to get automatic updates, get your own profile and make new friends.

Of course, you can also enjoy our collection of amazing optical illusions and cool math games.

If you like our site, you may support us by simply clicking Google "+1" or Facebook "Like" buttons at the top.
If you have a website, we would appreciate a little link to BrainDen.

Thanks and enjoy the Den :-)
Guest Message by DevFuse

- - - - -

Colored balls in a bag

Best Answer plasmid, 11 May 2014 - 06:02 PM

Spoiler for atrocious but verified answer


Spoiler for this agrees with simulation - perl code
Go to the full post

  • Please log in to reply
10 replies to this topic

#11 m00li


    Junior Member

  • Members
  • PipPip
  • 71 posts

Posted 25 May 2014 - 03:16 AM

More recursions:


Let f(t,m) denote the number of ways of arranging m colored balls in t slots, where t >= m and supply of each m coloured ball is infinite. Then final answer is nCmf(t,m) / nt


Here are the different recursions I have come up with for f(t,m)   (alas, no direct formula in m,n)


1) mtmC1f(t,1) - mC2f(t,2) - mC3f(t,3) .... - mCm-1f(t,m-1) 


2) tC1f(t-1,m-1) + tC2f(t-2,m-1) + tC3f(t-3,m-1) + ... + tCt-m+1f(m-1,m-1)


3) mf(t-1,m-1) + m2f(t-2,m-1) + m3f(t-3,m-1) + ... + mt-m+1f(m-1,m-1)


4) m( f(t-1,m) + f(t-1,m-1) )


where f(t,1) = 1, f(t,2) = 2t-2, and f(t,t) = t!


And finally one kind of non recursive form:


5)     f(t,m) = mtmC1(m-1)tmC2(m-2)tmC3(m-3)t + ....(-1)m-1(mCm-1)  (This one gives the AHA insight into the solution) :)

Edited by m00li, 25 May 2014 - 03:19 AM.

  • -1

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users