Ayub Farah

Blog - LinkedIn - GitHub - Email - Resume


Combinatorics and Brainrot

December 4, 2025

Beginning earlier this year, the internet was introduced to the 6-7 Meme, and it's gotten massive. So big that my friends and I are beginning to notice these numbers everywhere. On receipts, in movies and shows, in podcasts, barcodes, basically any string of digits you can find out in the wild. Of course, this could just be some classic frequency illusion at work. Still, out of curiosity, I wanted to see if I could figure out the probability that any nn-sized string of digits would have the numbers 66 and 77 appear within it, in that order.

Before I dive in, I'd like to mention a similarly interesting problem I saw in a textbook before. It goes a bit like this: we want to know how many games are played every year during the NCAA Division 1 Men's Basketball Tournament. The author reasons that every game has a loser, and no two games have the same loser. What this allows us to do is say that there are the same number of games as there are losing teams. We know that 3232 teams play in the tournament, and only 11 wins, so the other 3131 lose, therefore there are 3131 games.

This is similar to the kind of problem we want to solve right now, where we reason to find the right formula, and sometimes we get to use neat tricks like the losers-to-games equivalence we used. Note that for 66, 77 to appear in a string we'd need at least two digits in it, so n2n \geq 2. Throughout this process, we rely on something called the Multiplication Principle. It goes something like this:

Theorem. If there are aa ways to do one thing, and bb ways to do something else, then there are abab ways of doing both things.

To start, we'd like to know how many strings of nn digits there are. We can determine this in a step-by-step process. Say our string has no digit, we're choosing the first digit. Since we have 1010 digits to choose from, we have 1010 possible ways to do this. Let's move on to the next digit. Again, we have 1010 digits to choose from, so another 1010 possible ways to do this. By the Multiplication Principle, we have 10210^2 ways of choosing both digits, meaning there are 10210^2 different possible strings of two digits.

From here, it shouldn't be too hard to convince yourself that there are 10n10^n different ways to choose nn digits for an nn-size string, so there are 10n10^n such strings. We're gonna use this in our probability formula.

Next, we want to find how many strings of nn digits have 66 and 77 appearing within them. Let's go back to the idea of building a string of nn digits. We want to know what positions we can put 66 and 77. We have nn positions, from 00 to nn, so there are nn positions for 66 to be in. Since 77 can't be in the same position as 66, we have n1n-1 choices for 77. By the Multiplication Principle, there are n(n1)n(n-1) different ways to position 66 and 77.

What about the rest of the string? We don't really want to see 66 or 77 appear again, so for every other digit we only have 88 options really. Since we have n2n-2 positions left to fill and 88 options of digits for each, we have 8n28^{n-2} ways for the rest of the string to look. With another application of the Multiplication Principle, we have n(n1)8n2n(n-1) \cdot 8^{n-2} strings of nn digits where 66 and 77 appear once.

Here's the issue, though: if we assume n=4n = 4 for a second, you'll notice that our possibility includes 06070607 as well as 07060706. As per the meme, it's 676-7, not 767-6. This means we want strings like 07060706 to be ignored. Thankfully, we have a neat way to do this. Observe that if you take any of these strings of nn digits where 77 is before 66 (the way we don't want), and you swap around 77 and 66, you get a string of nn digits where 66 is before 77 (which we do want). This tells us that there is the same amount of each (think about it). Meaning, within our n(n1)8n2n(n-1) \cdot 8^{n-2} strings, exactly half will be the way we want, and half will be the way we don't want. Then, naturally, our new number is

n(n1)8n22 \frac{n(n-1) \cdot 8^{n-2}}{2}

The last and final step is pretty straightforward. What we wanted at the end of the day was to know how many out of a bunch of strings will have this quality we want. Since our bunch of strings comes out to 10n10^n and the number of special strings is n(n1)8n22\frac{n(n-1) \cdot 8^{n-2}}{2}, we divide them and get a probability of

n(n1)8n2210n\frac{n(n-1) \cdot 8^{n-2}}{2 \cdot 10^n}

Now for some application. Let's compute the probability for different sizes of nn to see how the raw probabilities are using some Python.


    formula = lambda n: ( n*(n-1) * (8 ** (n-2)) ) / (2 * (10 ** n))
    for i in range(2, 16): 
        print(f"{formula(i) * 100:.2f}%")


    1.00%
    2.40%
    3.84%
    5.12%
    6.14%
    6.88%
    7.34%
    7.55%
    7.55%
    7.38%
    7.09%
    6.70%
    6.25%
    5.77%
    

Now we can say, for example, that the average barcode has a 7.097.09% chance of having 66 and 77 appear in it in that order.

Earlier I mentioned some examples in the wild, and I wasn’t kidding. Here are four instances from the show Stranger Things:

From Season 4 From Season 4 From Season 2 From Season 4

These examples show that the 6677 pattern appears in the real world. While probability helps us understand the likelihood of such occurrences, seeing them firsthand makes the pattern more tangible and concrete.