Ponder This Challenge - February 2026 - Blot-avoiding backgammon strategy
- Ponder This
Primle
In the popular game Wordle, players attempt to guess a five-letter word. After each guess, the colors of the letter tiles change to reflect the guess. Green tiles represent a letter in the correct place; yellow tiles represent a letter present in the solution, but not in that place; and gray tiles represent a letter not present in the word at all. The submitted word has to be present in the game's dictionary; one cannot simply choose arbitrary letters.
We discuss a similar game, where instead of guessing a five-letter word, we attempt to guess an -digit prime number (in the decimal system). As in the original Wordle, the guess must be a prime number. For this game, we want to pick a "good" initial guess. While there can be several ways to define "good" in this context, we choose the following: After the first guess, we obtain some pattern of green/yellow/gray connected to the digits in our guess. This pattern excludes some of the possible -digit prime numbers. Let be the number of remaining possible solutions after the first guess, given that was the guess and is the solution.
For example, if the solution is the four-digit prime number 4733 and our initial guess was 3637, the resulting pattern will be yellow-gray-green-yellow, and the possible remaining solutions are 1733, 2731, 4733, 7039, 7331, 7333, 7433, 7933, 8731, 9733, 9739.
Note the following exclusions from the possible solution set of the example:
* 6733 is excluded since 6 was gray, and so 6 is guaranteed not to be part of the solution.
* 3733 is excluded since the first '3' was yellow, and so 3 is guaranteed not to be the first digit.
* 2239 is excluded since 7 was yellow, but is not present at all in 2239.
So in this case, . An even better initial guess would have been 8731, which would have resulted in .
For -digits, we wish to find a prime number which minimizes the expected value of for a uniformly generated prime . That is, we wish to minimize where is the set of -digit primes.
Your goal: Find this for and compute . Return those two values as the solution.
A bonus "*" will be given for finding the solution for .
We will post the names of those who submit a correct, original solution! If you don't want your name posted then please include such a statement in your submission!
We invite visitors to our website to submit an elegant solution. Send your submission to the ponder@il.ibm.com.
If you have any problems you think we might enjoy, please send them in. All replies should be sent to: ponder@il.ibm.com
The solutions are 17923 for n = 5 and 1584269 for n = 7. Anders Kaseorg provided a more detailed list:
For n = 1, every p = 2, 3, 5, 7 has E[p] = 5/2 = 2.5.
For n = 2, best is p = 17 with E[p] = 89/21 = 4.238095238095238.
For n = 3, best is p = 179 with E[p] = 149/11 = 13.545454545454545.
For n = 4, best is p = 1237 with E[p] = 43997/1061 = 41.46748350612629.
For n = 5, best is p = 17923 with E[p] = 1016453/8363 = 121.5416716489298.
For n = 6, best is p = 124679 with E[p] = 13169147/34453 = 382.235131918846.
For n = 7, best is p = 1584269 with E[p] = 729641181/586081 = 1244.9493858357462.