
Originally Posted by
undefined
I am rather puzzled. I would like to write a brute force computer program (since 44C6 is pretty small) and compare results, then get to the bottom of it. I may or may not have time to do that right now.
Oh all right, as often happens I have made a silly error. Sorry about that.
Your original answer is right, and the book's answer is wrong.
Once you select the two colours to correspond to (for example) {1,1} then the colours for {2,2} are fixed, and by multiplying by 2 you double count.
Here's the Java program I wrote
Code:
import java.util.ArrayList;
public class ColouredBallsProb {
static int c;
public static void main(String[] args) {
long t=time();
c=0;
recurse(0, new ArrayList<Integer>());
System.out.println(c);
System.out.println("elapsed: "+(time()-t)/1000.0+" s");
}
static void recurse(int ind, ArrayList<Integer> balls) {
if(balls.size()==6) {
if (oneOfEach(balls)) c++;
return;
}
if(ind>43) return;
// select or don't select current ball
recurse(ind+1,balls);
ArrayList<Integer> nextBalls=new ArrayList<Integer>(balls);
nextBalls.add(ind);
recurse(ind+1,nextBalls);
}
static boolean oneOfEach(ArrayList<Integer> balls) {
// assume 6 balls
int i;
boolean[] colours=new boolean[4];
for (i=0;i<6;i++) {
colours[balls.get(i)%4]=true;
}
for (i=0;i<4;i++)
if(!colours[i])
return false;
return true;
}
static long time() {
return System.currentTimeMillis();
}
} Output
Code:
3074610
elapsed: 1.101 s
As you can see it matches the first answer you gave (just the numerator). Sorry for the mix up.