The universal ticket

I am submitting a very interesting problem from a French mathematical recreation site:

http://www.diophante.fr/problemes-par-themes/g-probabilites/g2-combinatoire-denombrements/1434-g248-le-billet-universel

This is a 10-year-old problem, and they gave me their consent to share it here (provided of course, that I cite the author of the problem: Michel Lafond). I used to spend time on this... The problem is still open (this is an optimization problem).

Let me define tickets and coupons: A ticket is a 3x3 square with a value on each square. The ticket value is the sum of all squares. From this square, we can extract a coupon, which basically is a polyomino, to pay any sum from 1 to the ticket value.

A valid ticket is a square from which we can extract coupons for all sums from 1 to the ticket value.

Example from original site, with a 3x3 ticket of value 90, allowing to pay any sum from 1 to 90:

We can show that this is a valid ticket (all sums from 1 to 90 can be paid with polyominos extracted from this ticket)

2 Questions Here:

1. try to find a valid 3x3 ticket maximizing the possible sum we can pay (note that ALL values from 1 to ticket value must be possible) (Original question was: try to find a valid 3x3 ticket of value 100)
1. try to find a valid 4x4 ticket maximizing the possible sum we can pay (Original question was for a 4x4 valid ticket of value 1000)
• "try to find a 4x4 ticket": you mean a valid one? Jun 27, 2022 at 0:15
• A rough upper bound for the optimal solution is the number of polyominos. There are 2^9-1=511 ways to pick some subset of the 9 squares but of course a lot of these are not connected so the number polyominos is lower than that. Just saw that the linked page in French already computed that. There are 218 possible polyominos. Jun 27, 2022 at 6:13
• @quarague this upper bound is $218$ for $n=3$ and $11506$ for $n=4$: oeis.org/A059525 Jun 27, 2022 at 6:15
• ooh I like this problem! I can see myself spending months on this Jun 27, 2022 at 23:50
• I wrote a simulated annealing algorithm that managed to find the best known value (165) three times. Each time the solution was identical to the one posted on the French site, so there is no point repeating it here. The 4x4 is much much harder. Jun 29, 2022 at 13:41

The previously best-known solution has score of 165, with the following grid:

$$\begin{matrix} 3 & 1 & 16 \\ 2 & 8 & 7 \\ 70 & 26 & 32 \\ \end{matrix}$$

From a clever brute-force search, one can learn that

this is the optimal solution assuming all entries are nonnegative integers. The solution is unique up to rotation and reflections.

However, you can do better! The ticket

$$\begin{matrix} 2 & -1 & 7 \\ 3 & 10 & 11 \\ 36 & 24 & 77 \\ \end{matrix}$$

achieves a score of

170.

• Well done! I did never try this on my side... Do you think this can this be improved? Jul 4, 2022 at 7:05
• @franckvivien: On an even bet, I would bet it could be improved, yes. My search for nonnegative integer entries was exhaustive, but it gets super slow with negative entries because of all the potential for cancellation. I tried placing a single -1 in the grid. I wouldn't be surprised if this was the best possible there, but I didn't even finish that search in full. I am "worried" (or honestly: excited!) the actual optimum might have a very negative entry, which is currently outside of the reach of my exhaustive searches. Perhaps a more random search would find something! Jul 4, 2022 at 12:32

Very unlikely to be optimal, but got to 120 on my first go:

Approach:

1. mess around with the problem until it becomes clear that connectivity of the squares will be the main problem.
2. invent glue, place it in the middle
3. split the rest of the grid in two: one side for counting ones, the other side for counting the tens (which turned out to be elevens this time around)
• According to the link as of 2010, 165 is the highest one found Jun 26, 2022 at 23:55
• Nice answer with manual search and smart use of the 0! How would this transpose to 4x4? Jun 27, 2022 at 7:04
• You can change the middle to 1, to increase all sums by 1. Then the range will be 1-121 instead of 0-120, improving this solution by 1. Jun 27, 2022 at 8:47
• @Kruga I believe you can even change the middle to 2 increasing all sums with 2. making it able to go from 2-122, but there's a single 1 as well so we can make 1-122. EDIT: Actually you could make it 3 even if I'm not mistaken, so we get 1-123
– Ivo
Jun 27, 2022 at 13:02
• Yeah, if it weren't for the connectivity requirement, the solution would be trivial - just use every power of 2 from 2^0 to 2^(n-1) (where n is the total number of cells in the square) - gets you any number from 1 to (2^n)-1, so 1-511 for a 3x3, 1-65,535 for 4x4. Jun 27, 2022 at 17:24

Update: Honing in the parameters allowed for a score of 153. This is much closer than I expected to get to the 165 mentioned on the website.

original:

I decided to go for a brute force approach and managed a score of 141

I generated pseudo-random 3x3 tickets and checked whether or not they were valid solutions.

Tickets were created through the following method:

• Create a 3x3 matrix of random integers 1 to 35
• Change another one of the values to be a number between 50 and 70 in order to achieve a higher score (I'll probably do more tests with higher numbers later)
• I have found that almost all of my solutions with a score greater than 130 have had the numbers 1-4 present, so I made sure all my tickets tested had those 4 numbers

This is by no means the optimal way to generate a ticket, it's just the best method that I found to generate high scoring solutions at a reasonable rate.

The highest single tile that I managed to generate was 67 on this ticket:

• If I end up generating any better tickets I'll leave a comment or update my answer if its substantial enough Jun 29, 2022 at 2:09
• 70 26 32 2 8 7 3 1 16 is 165 one fyi.
– Oray
Jun 29, 2022 at 15:05