Probability of Consecutive Numbers in a Lottery

A recent question about lottery numbers reveals that a seemingly special event is in fact surprisingly common: namely, the presence of consecutive numbers in a lottery drawing. The calculation is an interesting one, and we’ll also see a way to check our answer, then compare it to reality.

Sequences with exactly one pair of consecutive numbers

Here is the question, from the last day of 2023:

With a sequence of numbers between 1 and 49 inclusive – how many combinations would occur for there to be 6 numbers with 2 and only 2 of the 6 being consecutive.

Example: 5, 15, 16, 27, 35, 42

Clarifying the question

This needed clarification; it can be hard to state a probability question clearly, especially in the abstract, just as it can be hard to interpret a problem when you read it. I answered,

Hi, Bill.

I don’t fully understand the question.

Are you supposing we have been given a sequence of numbers (of any length), and you want to know how many subsequences of 6 terms there are that contain exactly one pair of consecutive numbers? That would depend on the particular sequence given; are you looking for an algorithm to find this number?

Or are you asking how many sequences (increasing sequences of 6 distinct numbers, as in the example?) there are with exactly one pair of consecutive numbers? Or perhaps you really mean sets rather than sequences?

Perhaps you can make this clearer by describing the context of your question. What sort of statistical problem are you working on? Or, if this is a problem you were given, can you state it exactly as asked, rather than a paraphrase?

The word “sequence” in a combinatoric question generally indicates that order matters and repetition is allowed, and in particular that the same numbers could be put in different orders and counted as different. It will turn out that in fact order doesn’t matter in this sense, and repetition is allowed; this is what I suggested in my alternative interpretation.

Bill replied:

It’s a lottery situation – 6 numbers from 49 = 13,983,816 combinations so I was wondering how many combinations would be if two of the numbers were consecutive in the sequence?

This provides both a clear context, and the right formal word: A lottery involves a combination: a set of distinct numbers, in which order is not distinguished (so that listing the numbers in increasing order fully describes them).

And, indeed, the number of combinations of 6 chosen from 49 is $$\require{AMSmath}{\binom{49}{6}}=\frac{49!}{6!(49-6)!}=\frac{49!}{6!43!}=\frac{49\cdot48\cdot47\cdot46\cdot45\cdot44}{6\cdot5\cdot4\cdot3\cdot2\cdot1}=13,983,816$$

Starting to think …

Now I could answer:

That does clarify the question.

Now, in order to help me know what kind of answer to give, can you tell me whether you ask in order to learn how to calculate combinations, or for some practical reason? (or just from curiosity)

Meanwhile, I’ll see how hard it is to find. (Some combinatorial problems are harder to solve than they’re worth, but this probably isn’t too bad. It’s worth more, though, if you learn something useful from it …)

When the purpose is to learn, I avoid giving too much of the solution; here that probably isn’t the purpose, but I wanted to give Bill time to think, if he chose to.

Solving the problem

However, after a 24-hour wait (over New Year’s Eve) with no response and plenty of time to ponder, I changed my mind; it didn’t sound like a homework problem, and it would probably be too hard to lead anyone to discover the solution for himself, so why not do it?

I was able to solve the problem, and it’s interesting, so I’ll just answer the question fully. Here is my work:

First, as you know, the total number of ways to choose 6 of 49 numbers is C(49, 6) = 13,983,816.

The probability is the number of ways to “succeed” (in this case, to make a combination with exactly one pair of consecutive numbers), over the total number of ways to make any combination. So this number, which he already knew, will be the denominator. It’s the numerator that is tricky!

6 marbles in slots

I often start by modeling what we want in some physical way, whether it’s balls in an urn, cards in a hand, letters in a word, or whatever. Here, where our original model was a list of 6 numbers, I chose to think first of putting all 49 possible numbers in a row and selecting 6 of them, and then to transform that image into 49 places in a row, and putting markers into 6 of those places.

A choice of 6 distinct numbers from 1 to 49 can be visualized as putting marbles in 6 of 49 slots:

_ _ _ _ _ _ _ _ o _ _ _ _ _ _ _ o _ o _ _ _ _ _ o _ _ _ _ _ _ _ _ _ o _ _ _ o _ _ _ _ _ _ _ _ _ _

= 9, 17, 19, 25, 35, 39

A choice with exactly two consecutive, corresponds to a placement of marbles with exactly one pair adjacent:

_ _ _ _ _ _ _ _ o _ _ _ _ _ _ _ o o _ _ _ _ _ _ o _ _ _ _ _ _ _ _ _ o _ _ _ o _ _ _ _ _ _ _ _ _ _

= 9, 17, 18, 25, 35, 39

5 marbles and a pair in slots

We can now imagine gluing that pair together to make a special object. That gives us one less object, and one less slot.

This is equivalent to a choice of 5 out of 48 slotsnone of them adjacent, with one of the 5 distinguished:

_ _ _ _ _ _ _ _ o _ _ _ _ _ _ _ * _ _ _ _ _ _ o _ _ _ _ _ _ _ _ _ o _ _ _ o _ _ _ _ _ _ _ _ _ _

Thus, our answer will be 5 times the number of ways to choose 5 of 48 slots with none adjacent:

_ _ _ _ _ _ _ _ o _ _ _ _ _ _ _ o _ _ _ _ _ _ o _ _ _ _ _ _ _ _ _ o _ _ _ o _ _ _ _ _ _ _ _ _ _

That is, we are now first selecting 5 non-adjacent slots out of the 48, and than choosing 1 of those 5 into which to put two marbles.

Empty slots around marbles

But we still need a way to make sure none of the slots we pick are adjacent.

Now, how can we count those?

I’ll be using a method explained in

Stars and Bars: Counting Ways to Distribute Items

We can make such an arrangement by first putting the 5 marbles in a row,

o o o o o

and then placing 43 empty slots among them, making sure to put at least one in each of the 4 intervals between the marbles, but allowing the spaces at either end to remain empty.

I think of this process as turning the problem inside-out: Rather than putting marbles in slots, we are putting slots among the marbles! But since we want to make sure there are empty slots between each pair of marbles, but we allow the possibility of no space at the ends, that model is not yet right.

Marbles between empty slots

We’ll turn the model inside-out again, this time treating the empty slots as objects in themselves, and not putting marbles into slots, but in spaces between them:

But we can count more easily if we reverse the process: First place the 43 empty slots, leaving 44 places between and around them in which to put 5 marbles, no more than one in each space!

?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?

So there are C(44, 5) = 1,086,008 ways to do this, and the final answer will be 5 times that:

5 * 1,086,008 = 5,430,040.

Putting marbles into separate spaces between empty slots ensures that they are not consecutive.

What we’ve done here is sort of like solving a puzzle box, turning the box to different orientations and pushing a button here, then another there, until it falls open. And what’s in the box? The probability we’re looking for:

The probability of exactly two consecutive numbers is 5,430,040/13,983,816 = 0.3883. So more than 1/3 of the time, you will expect this to happen.

There’s the surprise! The question presumably arose from seeing this happen often in lottery numbers, and thinking that the observed frequency was greater than expected.

Putting it together, our calculation was $$\frac{5\cdot\binom{44}{5}}{\binom{49}{6}}=\frac{5,430,040}{13,983,816}=0.3883$$

Generalizing as a way to check

One technique for getting started with a problem is to try a smaller version of the problem first; but we can also use a smaller problem as a way to check a general formula. This is, in fact, a major reason for the technique of solving a generalized problem in order to solve a particular problem. Here, we’ll generalize what we’ve already done, just so we can do that check.

Let’s check with a smaller example, something I like to do when I am not entirely sure of my work in a problem like this.

First, the general formula for a lottery of k numbers out of n, following the same reasoning as for our k=6, n=49, is (k-1)*C(n-k+1, k-1)/C(n,k).

This is $$\frac{(k-1)\cdot\binom{n-k+1}{k-1}}{\binom{n}{k}}=\frac{5,430,040}{13,983,816}=0.3883$$

and corresponds to our calculation above.

If we choose 3 numbers from 1-6, taking k=3 and n=6, this gives 2*C(4, 2)/C(6,3) = 2*6/20 = 0.6.

This example is small enough to list all outcomes:

In fact, here are the 20 possible choices, with the single pairs in red:

123 (two pairs)

124

125

126

134

135

136

145

146

156

234 (two pairs)

235

236

245

246

256

345 (two pairs)

346

356

456 (two pairs)

That’s 12/20 = 0.6, just as the formula said. So I’m confident applying it to the real lottery.

Checking against reality

As a further check, I looked up results for the Canadian “Lotto 6/49” for 2023 to the present, and of 114 draws, 46 had exactly one consecutive pair, 11 had two, and 2 had three:

  • 25th February 2023: 2, 23, 24, 25, 39, 40
  • 4th October 2023: 18 19 26 27 29 30

This means that 40.35% had exactly one, and 51.75% had at least one. This is reasonably close to our calculation of 38.8% for exactly one.

How about at least one consecutive pair?

One more thought: When I searched to see if this was a well-known question, I found a paper about a broader problem, one conclusion of which is that the probability of at least one pair of consecutive numbers is 0.495198. As expected, this is higher than ours (almost 1/2, in comparison to over 1/3). In fact, we can use what we did above to solve this one easily:

The probability that there is at least one pair of consecutive numbers is 1 minus the probability that there are no pairs. So we need to count the ways to place 6 marbles and 43 empty spaces, with at least one of the latter between any two of the former:

_ _ _ _ _ _ _ _ o _ _ _ _ _ _ _ o _ o _ _ _ _ _ o _ _ _ _ _ _ _ _ _ o _ _ _ o _ _ _ _ _ _ _ _ _ _

We can do this by choosing 6 of the 44 places between or around the 43 empty spaces:

?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?_?

This is C(44, 6) = 7,059,052; the probability is 7,059,052/13,983,816 = 0.5048, and our answer is 1 – 0.504802 = 0.495198.

That is close to our observed probability of 51.75%. Conclusion:

Pairs of consecutive numbers are considerably more common than you might expect!

Bill replied,

Excellent answer – thank you very much for giving such a clear explanation.

Presumably, whatever the goal, it was satisfied.

1 thought on “Probability of Consecutive Numbers in a Lottery”

  1. Thank you for answering this. Nearly every time I buy a lucky dip lottery ticket, I get two consecutive numbers within the 6 numbers. It doesn’t feel that this should happen as often as it does. I am now going to keep note of the ticket numbers to see if it is happening as frequently as it appears to.

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.