Originally Posted by

**blacksmithden**
I dont know what is more disturbing. The odds of winning or the fact that you knew how to figure that out. Why arent you running the world yet Bob ? Lol.

Thank you for the kind words, but I think

Originally Posted by

**RangeBob**
Gun Giveaway odds : 1 in 4,282,300,626,240 [n!/(n-r)! ; order important; n = 338 seats, r = 5 parties]

makes at least 2 errors

- it assumes that each party gets at least 1 seat (i.e. it misses 0 (zero))
- I think it's the odds of each riding getting particular combinations, rather than the total by party which is all we care about.

And of course it ignores that the Bloc can have 78 seats max.

I'm more confident with this

Code:

DecimalFormat formatter = new DecimalFormat("#,###");
int count = 0;
for (int con = 0; con <= 338; con++) {
System.out.print(".");
for (int lib = 0; lib <= 338; lib ++) {
int subtotal2 = con + lib;
if (subtotal2 > 338) break;
for (int ndp = 0; ndp <= 338; ndp ++) {
int subtotal3 = subtotal2 + ndp;
if (subtotal3 > 338) break;
for (int bloc = 0; bloc <= 78; bloc ++) { //78 Seats in Quebec
int subtotal4 = subtotal3 + bloc;
if (subtotal4 > 338) break;
for (int green = 0; green <= 338; green ++) {
int total = subtotal4 + green;
if (total == 338) count++;
if (total > 338) break;
}
}
}
}
}
System.out.println("");
System.out.println("Gun Giveaway odds : " + formatter.format(count));

which returns

Gun Giveaway odds : 365,245,440