Anti-Hilbert Problem

The Hilbert problems were laid out by David Hilbert as the most important unsolved problems in mathematics. Some have been solved since his death, and some have not.

One problem that has similarly been unsolved is called the “Anti-Hilbert Problem,” as this problem is certainly not important, but has caused mathematicians and programmers decades of struggle.

Based on this paper from 1999, the Anti Hilbert Problem asks if the card game Beggar My Neighbor (BMN) has an infinite cycle. In other words, can the cards be dealt so that the game goes on forever?

If you have never played Beggar My Neighbor, it is a game similar to War, which most children have played, or Egyptian Rat Screw (aka “slaps”). The game is entirely luck and does not allow the individual to implement any kind of skill, meaning it can be easily simulated. So why has computing power not solved this problem yet?

There are 6×1020 different possible combinations of hands when dividing a deck of cards to two players. I have personally found that 5 billion simulations in Python (this would be a good time to know C) on an M1 Mac takes approximately a full day. With over a month of dedicating my personal computer to this problem, I can estimate that I have run 1.5×1011 simulations of BMN. That means I have only scratched the surface of possible simulations, at 1×10-9 total simulations or 0.0000007%.

So it would be crazy to think I could solve this, right? Well, the optimist in me says otherwise. I have put in work elsewhere, solving much shorter games of BMN with similar distributions of cards. I have run simulations on games from 10 cards to 38 cards, scaling the distributions of face cards to non-face cards to make it more similar to the 52 card game.

After investigating all of these solutions and searching for signals in the noise, I have found one often recurring sequence:

–J-

Note: a dash represents any card between 2 and 10, as they all function the same, while face cards function differently.

In approximately 70% of my solutions, a hand consisting of only – – J – shows up somewhere in the game.

I have also found that simulations with – – J – speeds up compute time for shorter games, as it injects a hand with a higher potential for an infinite loop to be run each time instead of requiring the simulation to end up at the sequence randomly. Unfortunately, I have also found games where – – J – is not a solution, but it is for most. And finally, since it is not part of every infinite loop, I am further limiting the potential solutions that can be found, but I believe these tradeoffs are worth it.

So, assuming – – J – is a solution for the 52 card game, I am hopeful that I will land at a solution soon. I haven’t done the real calculations on this, but it doesn’t seem crazy to believe that injecting – – J – would simplify the computational complexity by several orders of magnitude. I am also looking for patterns of what the corresponding hand often starts with; if I was able to inject 5 more cards to the other hand that happened to be a solution, then I would only be randomly selecting 41 cards, and I have successfully solved the 42 card game. This leads me to think that I’m not far off!

With this solution, since I am artificially starting one hand with only 4 cards instead of 26, it is possible that there will not be a 26-card hand in the infinite loop, but it is also possible that I could construct starting hands to land at the infinite loop if I know the hands that need to be constructed to enter that loop. This might take some time and effort but would almost certainly be possible, especially because the loops are often quite long and would likely include a 20-something card hand.

I will continue to dedicate my compute to this meaningless, pointless problem, and look for more patterns in shorter games.

Leave a comment