We all know that the famous chocolate,
m & m’s
generally comes in
r
e
d
,
o
r
a
n
g
e
,
y
e
l
l
o
w
,
g
r
e
e
n
,
b
l
u
e
and
b
r
o
w
n
.
Right now, I have
3 m & m’s
for each of the
6
colors mentioned above, making a total of
18
.
12
children come to me hoping that they could enjoy some chocolates.
Unfortunately, they are pretty picky and each of them makes a different request as follows:
The
1st
child wants no more than
1
r
e
d
m & m’s
.
The
2nd
child wants no more than
1
o
r
a
n
g
e
m & m’s
.
The
3rd
child wants no more than
1
y
e
l
l
o
w
m & m’s
.
The
4th
child wants no more than
1
g
r
e
e
n
m & m’s
.
The
5th
child wants no more than
1
b
l
u
e
m & m’s
.
The
6th
child wants no more than
1
b
r
o
w
n
m & m’s
.
The
7th
child wants no more than
2
r
e
d
m & m’s
.
The
8th
child wants no more than
2
o
r
a
n
g
e
m & m’s
.
The
9th
child wants no more than
2
y
e
l
l
o
w
m & m’s
.
The
10th
child wants no more than
2
g
r
e
e
n
m & m’s
.
The
11th
child wants no more than
2
b
l
u
e
m & m’s
.
The
12th
child wants no more than
2
b
r
o
w
n
m & m’s
.
Each of the child has a special request for each of the color.
For each of a child who does not make request for the other remaining colors, he or she can receive any
non-negative number
of them.
Any one of the child will cry if his or her request is not fulfilled.
How many ways are there to distribute your
m & m’s
to them so that no one cries?
If your answer when expressed in prime factorization, is
p
1
n
1
⋅
p
2
n
2
,
where
p
1
,
p
2
are primes which are
distinct
and
n
1
,
n
2
are positive integers which
need not
be
distinct
.
Give your answer as
p
1
+
n
1
+
p
2
+
n
2
.
Bonus:
Do not use calculator.
This is part of the set
Things Get Harder!
.
We notice that there is recursion of demands that comes in pairs.
For instance,
the 1st child wants no more than 1 r e d m & m’s and the 7th child wants no more than 2 r e d m & m’s ,
the 2nd child wants no more than 1 o r a n g e m & m’s and the 8th child wants no more than 2 o r a n g e m & m’s ,
...
With that being said, we shall focus on computing the pair of requests from one of the colors, say r e d and compute the total number of ways of distribution by rule of product .
Let x 1 be the number of chocolates received by the 1st child and x 7 be the number of chocolates received by the 7th child.
The only possible solutions for x 1 , x 7 are:
x 1 = 0 , x 7 = 0
x 1 = 1 , x 7 = 0
x 1 = 0 , x 7 = 1
x 1 = 1 , x 7 = 1
x 1 = 0 , x 7 = 2
x 1 = 1 , x 7 = 2
When x 1 = 0 , x 7 = 0 ,
x 2 + x 3 + . . . + x 6 + x 8 + . . . + x 1 2 = 3
By Stars and Bars Theorem , there are ( 9 1 2 ) non-negative integer solutions to the equation.
When x 1 = 1 , x 7 = 0 and x 1 = 0 , x 7 = 1 ,
x 2 + x 3 + . . . + x 6 + x 8 + . . . + x 1 2 = 2
By Stars and Bars Theorem , there are ( 9 1 1 ) non-negative integer solutions to the equation.
But since there are two possible solutions for x 1 , x 7 , we have ( 9 1 1 ) ⋅ 2 solutions here.
When x 1 = 1 , x 7 = 1 and x 1 = 2 , x 7 = 0 ,
x 2 + x 3 + . . . + x 6 + x 8 + . . . + x 1 2 = 1
By Stars and Bars Theorem , there are ( 9 1 0 ) non-negative integer solutions to the equation.
But since there are two possible solutions for x 1 , x 7 , we have ( 9 1 0 ) ⋅ 2 solutions here.
When x 1 = 2 , x 7 = 1 ,
x 2 + x 3 + . . . + x 6 + x 8 + . . . + x 1 2 = 0
There is a only 1 non-negative integer solution here.
∴ , for one single color, there is a total of ( 9 1 2 ) + ( 9 1 1 ) ⋅ 2 + ( 9 1 0 ) ⋅ 2 + 1 = 3 5 1
By rule of product , the number of ways of distribution = 3 5 1 6 = ( 3 3 ⋅ 1 3 ) 6 = 3 1 8 ⋅ 1 3 6
∴ p 1 + n 1 + p 2 + n 2 = 3 + 1 8 + 1 3 + 6 = 4 0
Bonus:
( 9 1 2 ) + ( 9 1 1 ) ⋅ 2 + ( 9 1 0 ) ⋅ 2 + 1
= ( 9 1 2 ) + ( 9 1 1 ) + ( 9 1 0 ) + 1 + ( 9 1 1 ) + ( 9 1 0 )
= ( 9 1 2 ) + ( 9 1 1 ) + ( 9 1 0 ) + ( 1 0 1 0 ) + ( 9 1 1 ) + ( 9 1 0 )
= ( 9 1 2 ) + ( 9 1 1 ) + ( 1 0 1 1 ) + ( 9 1 1 ) + ( 9 1 0 )
= ( 9 1 2 ) + ( 1 0 1 2 ) + ( 9 1 1 ) + ( 9 1 0 )
= ( 1 0 1 3 ) + ( 9 1 1 ) + ( 9 1 0 )
= ( 1 0 1 3 ) + ( 9 1 1 ) + ( 9 1 0 ) + 1 − 1
= ( 1 0 1 3 ) + ( 9 1 1 ) + ( 9 1 0 ) + ( 1 0 1 0 ) − 1
= ( 1 0 1 3 ) + ( 9 1 1 ) + ( 1 0 1 1 ) − 1
= ( 1 0 1 3 ) + ( 1 0 1 2 ) − 1
= ( 3 1 3 ) + ( 2 1 2 ) − 1
= 3 ⋅ 2 ⋅ 1 1 3 ⋅ 1 2 ⋅ 1 1 + 2 ⋅ 1 1 2 ⋅ 1 1 − 1
= 2 8 6 + 6 6 − 1
= 3 5 1
The identities I utilized in my computation above are ( r n ) + ( r n + 1 ) = ( r + 1 n + 1 ) and ( r n ) = ( n − r n )
Detailed proofs can be read here .