Welcome to our community

Be a part of something great, join today!

Find the number of ways of giving 31 cupcakes to 5 students each receives odd number of cupcakes to each one

Monoxdifly

Well-known member
Aug 6, 2015
269
John has baked 31 cupcakes for 5 different students. He wants to give them all to his students but he wants to give an odd number of cupcakes to each one. How many ways can he do this?

Brute-forcing will take about a whole day, I think. If 4 students receive 1 cupcake and the other one receive 27, that's already 4 combinations. If there are 3 1's, the other two might be 3 and 25, 5, and 23, 7 and 21, etc. Is there more efficient way?
 

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,687
Hey Mr. Fly,

It's a variation of the stars and bars problem.
See the linked article how it works.

In this particular case we can add 5 cakes first for a total of 36.
Next we divide them in 18 stacks of 2 cakes each.
If we put 4 dividers (bars) in between them, we get 5 portions. We give them to each of the 5 students.
Oh, and before we do so, we take away 1 cake from each portion, so that each student gets an odd number.

How many ways to divide 4 bars over the 17 spaces between the stacks?
 

Monoxdifly

Well-known member
Aug 6, 2015
269

Klaas van Aarsen

MHB Seeker
Staff member
Mar 5, 2012
8,687