Jump to content
Function

Mastermind (possible combinations)

Recommended Posts

Hello

 

On a maths test, I got the following question:

 

The game mastermind starts with forming a secret code, formed by placing 4 coloured pins in a specific order. The pins are being chosen from 6 different colours.

 

How many codes are possible if a specific colour can't be repeated more than 2 times and open places aren't allowed?

 

My answer: [math]N=\bar{V}^2_6\cdot\bar{V}^2_5=900[/math]

 

I got 0/4 for this answer. Now I see it, I'd say I had to multiply it by 6 (the possibilities 2 pins can be placed), which would give 5 400 possibilities

 

My teacher's answer: [math]N=V^4_6+C^2_6\cdot\bar{P}^{2,2}_4+C^2_6\cdot C^1_4\cdot C^1_2\cdot \bar{P}^2_4 = 2 610[/math]

 

Don't get her last term... Why?

 

Thanks

 

Function

Edited by Function

Share this post


Link to post
Share on other sites

My teacher's answer: [math]N=V^4_6+C^2_6\cdot\bar{P}^{2,2}_4+C^2_6\cdot C^1_4\cdot C^1_2\cdot \bar{P}^2_4 = 2 610[/math]

 

 

 

The teacher's answer doesn't make sense to me. If there are no restrictions on duplication, you should have a maximum of 6^4 = 1296 possible choices of pins.

 

I get 2160 if I add:

360 the number of possibilities with 4 unique colors

1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color

360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair.

 

Is that what the teacher's equation represents?

 

 

I think this is an error mainly because 2160 is greater than 1296. !

I think maybe the error is that the order of the 2 same-colored pins doesn't matter, so the teacher is counting a lot of cases twice.

 

 

The answer I get is 1170 doing it 2 different ways:

1296 Total arrangements with no restrictions of duplicates

-6 arrangements of 4 pins all the same color

-120 arrangements of 3 pins of the same color.

 

Or... something like what the teacher did except ignoring order, I won't write it out because I think I did it a convoluted way.

Edited by md65536

Share this post


Link to post
Share on other sites

The teacher's answer doesn't make sense to me. If there are no restrictions on duplication, you should have a maximum of 6^4 = 1296 possible choices of pins.

 

I get 2160 if I add:

360 the number of possibilities with 4 unique colors

1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color

360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair.

 

Is that what the teacher's equation represents?

 

 

I think this is an error mainly because 2160 is greater than 1296. !

I think maybe the error is that the order of the 2 same-colored pins doesn't matter, so the teacher is counting a lot of cases twice.

 

 

The answer I get is 1170 doing it 2 different ways:

1296 Total arrangements with no restrictions of duplicates

-6 arrangements of 4 pins all the same color

-120 arrangements of 3 pins of the same color.

 

Or... something like what the teacher did except ignoring order, I won't write it out because I think I did it a convoluted way.

Hmm - I get the expected answer of 1296. This is just 6^4. Longhand logic per the spreadsheet screenshot below. What arrangements regardless of colour are unique multiplied by how can you fill those spaces with different colours.

 

post-32514-0-66039200-1394541518_thumb.jpg

 

But then I often seem to miss obvious points on combos/perms as evidenced by the last few threads on these issues :)

Share this post


Link to post
Share on other sites

Hmm - I get the expected answer of 1296. This is just 6^4. Longhand logic per the spreadsheet screenshot below. What arrangements regardless of colour are unique multiplied by how can you fill those spaces with different colours.

There is OP's caveat that a "specific colour can't be repeated more than 2 times", which if I understand means that the (4,0,0,0) and (3,1,0,0) arrangements aren't valid.

Share this post


Link to post
Share on other sites

There is OP's caveat that a "specific colour can't be repeated more than 2 times", which if I understand means that the (4,0,0,0) and (3,1,0,0) arrangements aren't valid.

 

Yep - which means my answer when corrected by removal of 4,0,0,0 and 3,1,0,0 would collapse to 1170; which is yours! Excellent. My fault for going on the idea of mastermind rather than the OP

Share this post


Link to post
Share on other sites

 

Yep - which means my answer when corrected by removal of 4,0,0,0 and 3,1,0,0 would collapse to 1170; which is yours! Excellent. My fault for going on the idea of mastermind rather than the OP

 

rather than my teacher ;)

 

Does my teacher's answer make sense anyhow? If so, can someone explain it to me?

 

The restriction just means that e.g. yellow-blue-green-red, yellow-red-yellow-red, blue-blue-red-green are allowed, whereas purple-purple-green-purple, for instance, is not allowed.

 

 

The teacher's answer doesn't make sense to me. If there are no restrictions on duplication, you should have a maximum of 6^4 = 1296 possible choices of pins.

 

I get 2160 if I add:

360 the number of possibilities with 4 unique colors

1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color

360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair.

 

Is that what the teacher's equation represents?

 

 

That would be it, I presume. Thanks.

 

As a matter of fact, I'm afraid my notations aren't very clear?

[math]\bar{P}^{a,b,c,...}_n[/math] is a repetitive permutation of n elements, to be chosen out of n elements, of which one element repeats a times, another b times, another c times, ... = [math]\frac{n!}{a!b!c!...}[/math]; sequence is important

 

[math]C^p_n[/math] is a combination of p elements to be chosen out of n elements; sequence of the elements is not important, and repetition is not allowed.

 

[math]\bar{V}^p_n[/math] repetitive variation of p elements to be chosen out of n; sequence is important, repitition is allowed

 

[math]V^p_n[/math] variation (same as above, but with repitition not allowed)

 

I think this is an error mainly because 2160 is greater than 1296. !

I think maybe the error is that the order of the 2 same-colored pins doesn't matter, so the teacher is counting a lot of cases twice.

 

She's not (see my explanation of the symbols above)

Edited by Function

Share this post


Link to post
Share on other sites

rather than my teacher ;)

 

Does my teacher's answer make sense anyhow? If so, can someone explain it to me?

 

The restriction just means that e.g. yellow-blue-green-red, yellow-red-yellow-red, blue-blue-red-green are allowed, whereas purple-purple-green-purple, for instance, is not allowed.

Yeah the restriction makes sense. The fact that MD65536 and I come to the same answer (once I have read the question properly) makes me feel that 1170 is the correct answer.

 

 

As a matter of fact, I'm afraid my notations aren't very clear?

[math]\bar{P}^{a,b,c,...}_n[/math] is a repetitive permutation of n elements, to be chosen out of n elements, of which one element repeats a times, another b times, another c times, ... = [math]\frac{n!}{a!b!c!...}[/math]; sequence is important

 

[math]C^p_n[/math] is a combination of p elements to be chosen out of n elements; sequence of the elements is not important, and repetition is not allowed.

 

[math]\bar{V}^p_n[/math] repetitive variation of p elements to be chosen out of n; sequence is important, repitition is allowed

 

[math]V^p_n[/math] variation (same as above, but with repitition not allowed)

 

 

She's not (see my explanation of the symbols above)

I think that MD65536 explanation in his first response matches your teachers

 

I get 2160 if I add:

360 the number of possibilities with 4 unique colors

1440 the number of possibilities with 2 ordered pins of the same color, with 2 others of unique color

360 the number of possibilities with 2 ordered pins of the same color, with the other 2 pins also an ordered pair.

 

 

Is that what the teacher's equation represents?

[latex] N=V^4_6+C^2_6\cdot\bar{P}^{2,2}_4+C^2_6\cdot C^1_4\cdot C^1_2\cdot \bar{P}^2_4 = 2 610 [/latex]

 

360 is the first term and is 6.5.4.3 and matches MD65535 first part

1440 is third term your teacher has given ie 15.4.2.12 and matches MD65536's second term

360 I guess is the second term of your teacher ie 15.24 -I don't fully understand the notation yet but 24 does not equal 4!/(2!*2!)

Share this post


Link to post
Share on other sites

She's not (see my explanation of the symbols above)

I say again your teacher is in error calculating the result. I know this sounds rather incredible but this conclusion is based on results from multiple calculations.

 

At least one of the places where you say "sequence is important" is suspicious. I think that for example your teacher is counting "First blue peg in slot A, second blue peg in slot B, red in C, yellow in D" and "Second blue peg in slot A, first blue peg in slot B, red in C, yellow in D" as two separate possibilities. When I counted such things separately, I got 2160. I think 2160 might be what you get if there were two numbered pegs of each color (and you made sure to always select a color's peg-1 before peg-2).

 

 

This sort of thing has cropped up before and it has always been due to human error.

Share this post


Link to post
Share on other sites

Teachers are only human and do make mistakes - although because they are human they might prefer it if you are polite and respectful when point those mistakes out.

 

1. Your question is a subset of potential mastermind solutions ie those without any colour repeated more than 2 times

2. As a subset it must be less than or equal to the set of mastermind solutions

3. The set of mastermind solutions is 6^4 =1296. This is simply 6 ways of filling first place times 6 ways of filing second times 6 ways thirds times 6 way fourth. This can be explicitly confirmed in the academic literature http://www.dcc.fc.up.pt/~sssousa/RM09101.pdf

4. Your answer can be arrived at in two ways removing the invalid plays from a total of 1296 OR adding the valid plays together. Both of these arrive at the value 1170. It is impossible that either of these are more than the total number of valid mastermind plays at 1296

 

I will finish explaining what I think went wrong after a coffee

Share this post


Link to post
Share on other sites

Let us denote the cases as ABCD(all colours differ) AABC and AABB.I don't know how to input math. My calculation is 6p4+6(5c2)(4!/2!) +6c2[4!/(2!)^2]. I get 1170.

Share this post


Link to post
Share on other sites

Rktpro

Yep - agree. Here in latex - it is not hard to use, the forum has a tutorial, and it is practically obligatory for science students

 

[latex] N=P^6_4+6 \cdot C^5_2\cdot\frac{4!}{2!}+ C^6_2\cdot \frac{4!}{2!^2} = 1170 [/latex]

http://www.wolframalpha.com/input/?i=6permute4%2B6%285choose2%29*%284!%2F2!%29+%2B+%286choose2%29+*+%284!%2F%282!%29^2%29

Function - please note that in UK and USA we tend to notate in this manner - for a set of n choosing k as

[latex]C^n_k[/latex] or [latex]{n\choose k}[/latex]

 

I believe France use it the other way around - it should always be obvious which is which biut just so you realise

Edited by imatfaal
Correction per Rktpro's message below

Share this post


Link to post
Share on other sites

Imatfaal-I use mobile device and it is very difficult to handle, its touch screen and to input a parenthesis I have to touch thrice. You made a mistake in the second term of my calculation though. :) Forgot to include the arrangement term.

Share this post


Link to post
Share on other sites

Imatfaal-I use mobile device and it is very difficult to handle, its touch screen and to input a parenthesis I have to touch thrice. You made a mistake in the second term of my calculation though. :) Forgot to include the arrangement term.

 

Sorted. Ah yes wouldnt be easy. You can always try some of the online latex editors/compilers - but would still be a strain on a mobile device.

Share this post


Link to post
Share on other sites

Rktpro

Yep - agree. Here in latex - it is not hard to use, the forum has a tutorial, and it is practically obligatory for science students

 

[latex] N=P^6_4+6 \cdot C^5_2\cdot\frac{4!}{2!}+ C^6_2\cdot \frac{4!}{2!^2} = 1170 [/latex]

 

http://www.wolframalpha.com/input/?i=6permute4%2B6%285choose2%29*%284!%2F2!%29+%2B+%286choose2%29+*+%284!%2F%282!%29^2%29

 

Function - please note that in UK and USA we tend to notate in this manner - for a set of n choosing k as

 

[latex]C^n_k[/latex] or [latex]{n\choose k}[/latex]

 

I believe France Belgium use it the other way around - it should always be obvious which is which biut just so you realise

 

Ah yes, I'll keep that in mind. Thanks.

 

Thanks to everyone for their attribution

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.