Dear Reader,
Here in Europe, we have the weekly EuroMillions Lottery. As of today, 10th of November 2006, there were 243 Million Euros to win (That is USD 310′588′020, aka 310 Mio $). Of course everybody tried thier luck…
My lucky numbers for today were these:
14 22 35 38 44 - 3 7
01 13 21 37 40 - 7 8
21 25 36 47 50 - 2 3
18 23 43 46 47 - 4 8
03 21 25 43 50 - 5 7
My little EuroMillion Random Number Suggestion Program (see below) got these numbers for me and I was very exited. I filled out the lottery ticket already on wednesday and was eager to get my ticket down to the lottery counter and check it in…
However, things went terribly wrong, as I relied on this man:
This man was trying to get lucky too and also wanted to play the EuroMillion Lottery. But I should have been warned. That man is not quite a Michael Schumacher, nor does he own a Ferrari. In fact he is an “EL’ie”, a learning driver! He has one of these “L”’s on the back of his car and is only allowed to drive with experienced drivers in his passengers seat:
![]()
![]()

We drove up to the lottery counter and tried to find a parking lot. Because my unexperienced driver had not yet learned to drive backwards, we had to circle around a spot, like a roundabout, that had a traffic light in it.
My driving apprentice managed to stop in from of the traffic light in such a way, that the metal detection, built into the street never detected anybody that was waiting for a green light… And because driving backwards was out of question for the reason just mentioned, we had to wait for some other car to stop behind us and eventually make the traffic light realize that we in fact needed to get out of that situation immediately.
It was three minutes after half past six when we rushed up to the lottery counter to try our luck. - Three minutes too late - Three minutes away of my 243 million Euros!
Good bye my many Euros…
The guy who almost owed me the lottery jackpot did not get beaten up by me, just in case you think that that is why he looks so smashed up on the picture above. No, that happend three years ago, when he had an accident on his snakeboard. (Where he is professional at, I have to say here, just to stay fair).
But how high was the risk of my “only-forward-gears-please” driver to actually “owe” me my 243 million Euros really? - Let’s have a look:
The folks among you who still remember their combinatorics lessons will quickly find out, that chances to win are terribly low.
For those who skived school at the time, here is how we can figure it out:
In the EuroMillions Lottery you have to choose 5 out of 50 plus 2 out of 9, called numbers and stars. For the first cross we put on the lottery ticket, we can choose out of 50 numbers. For the second cross, only 49 possible free numbers are left. This goes on down to the last cross, where 46 unchosen numbers are left to choose from. Same story for the stars: here we choose out of 9 on the first draw and 8 out of the second.
Multiplying all those possibibilities gives us the total possible combinations of a fully defined lottery stake:
50 * 49 * 48 * 47 * 46 * 9 * 8 = 18'306'086'400
Now this is when the order of the draws matters, when 11 31 22 46 03 is different from 03 22 11 46 31 and so on. So there are some pairs that don’t have the same order, but the same numbers. How many?
1 * 2 * 3 * 4 * 5 = 120
for the first 5 numbers, and
1 * 2 = 2
for the stars and therefore 240 for all. By dividing we get
18'306'086'400 / 240 = 76'275'360
This number is represents all possible outcomes of the EuroMillion Lottery. Of course there is only one right answer. This gives the probability:
1 / 76'275'360
In a different notation this is equal to
1.311 * 10^(-8)
or
0.0000001311
or
NOTHING
We now know: the one and only correct answer tonight to win the lottery jackpot was: 14 21 27 30 36 - 2 3. But again, nobody won!
Well of course not, the probability to win this insane game is 0.0000001311 as we just found out. So why bother in the first place? How can anybody semi-intelligent throw his or her money away in such a game?
“Well - sometimes, somebody wins, right? So why not me?” you could argue…
Exactly! That’s just what my “almost debtor” and I thought as well. For professionals working with addicted people, this attitude is probably just about all it takes to be certain they are dealing with some serious cases… And in fact, if the lotteries jackpots were that high and were on every night, I truely think we would be bankrupt, stealing form ant Jenny, robbing kindergardeners and in jail by now…
Did I mention that in Germany, EuroMillions is illegal and the poor guys are not allowed to play in their country? Every German Hartz-IV receiver (that is almost everybody, cause you are better off that way than with actual work), who could somehow make it, took a trip into the coutries abroad where EuroMillions is allowed and spend all they had to play and hopefully win.
More on german invasions and politics that give the wrong incentives in another blog…
Because filling out the lottery ticket is so difficult for standard human brains, I quickly wrote a little Java program to take the burden of me to choose “pseudo good” numbers.
When a human fills out the tickets, evenly distributed patterns emerge, very often prime numbers are chosen. Therefore, the more prime numbers a win contains, the more people will have to share it.
Even when an individual knows these facts and tries to do exactly the opposite or some “random” way, it still is almost impossible. - That is, when a possible win is involved…
Test question: Someone puts down the following numbers on a lottery ticket. Do you think he or she is insane?
01 02 03 04 05 - 01 02
06 07 08 09 10 - 03 04
11 12 13 14 15 - 05 06
16 17 18 19 20 - 07 09
21 22 23 24 25 - 01 02
…get the point? - It doesn’t matter. Anybody playing is insane… These numbers are just as probable as any other.
So here is my little program that has no brain of its own and will just give you random numbers. (Caution: If you are superstitious and believe in lucky numbers, this program is not for you. After the test question above, probably no one is in his heart).
package org.theyellowmarker;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;
/** from http://www.theyellowmarker.org - raoul */
public class EuroMillionGuesser {
private int[] computeLuckNumbers(final int howMany, final int max) {
if(howMany >= max || howMany < 0 || max < 0) {
throw new IllegalArgumentException("Get out of here, you jerk");
}
int[] numbers = new int[howMany];
for(int i = 0; i < howMany; i++) {
numbers[i] = getNextLuckyNumber(0, numbers, max);
}
inSituBBSort(numbers);
return numbers;
}
private int getNextLuckyNumber(final int offset, final int[] numbers, final int max) {
final int luckyNumber = new Random().nextInt(max) + 1;
for (int i = offset; i < numbers.length; i++) {
if(numbers[i] == luckyNumber) {
numbers[i] = getNextLuckyNumber(offset, numbers, max);
}
}
return luckyNumber;
}
private int[] inSituBBSort(int[] numbers) {
for (int i = numbers.length; --i >= 0;)
for (int j = 0; j < i; j++) {
if (numbers[j] > numbers[j+1]) {
int tmp = numbers[j];
numbers[j] = numbers[j+1];
numbers[j+1] = tmp;
}
}
return numbers;
}
private String results(int[] numbers) {
final StringBuilder sb = new StringBuilder();
for (int i = 0; i < numbers.length; i++) {
if(numbers[i] < 10) {
sb.append("0" + numbers[i] + " ");
} else {
sb.append(numbers[i] + " ");
}
}
return sb.toString();
}
public static void main(String[] args) throws IOException {
EuroMillionGuesser emg = new EuroMillionGuesser();
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String str = "";
System.out.print("hit enter for next draw..., control-c for quitting");
while (str != null) {
str = in.readLine();
int[] mainNumbers = emg.computeLuckNumbers(5, 50);
int[] starNumbers = emg.computeLuckNumbers(2, 9);
System.out.print("You win! - Well, if and only if (aka iff): ");
System.out.print(emg.results(mainNumbers));
System.out.print("/ ");
System.out.print(emg.results(starNumbers));
}
}
}
Download: euromillionguesser.zip
You can use this little code snipped for other lotteries with different number schemes as well. Just change the arguments in the computeLuckyNumbers methods inside the main method and recompile. To run it, unzip the file and hit the start.bat file. Hitting enter will give you a new draw each time:
If you win with numbers from this little program, let me know and send some money over.
Nobody won this week. - Next week, 288 Million Euro will be in the jackpot. I will hand in my lottery ticket earlier this time. When blog entries about luxury goods and clever investment strategies start to appear here, you will know who has won it
.
Thank you.