Project Euler Problem 855

Given two positive integers a,b, Alex and Bianca play a game in ab rounds.

Project Euler Problem 855

Solution

Answer: 6.8827571976e-57

Let $V(R)$ denote the optimal final-area multiplier from a game state $R$ (the set of still-available labels).

If Bianca chooses a cell $(i,j)$ in the current round, then the game continues on that sub-rectangle, so the value contributed by that choice is

$$r_i c_j , V(R\setminus{(i,j)}),$$

where $(r_i)$ are the row proportions and $(c_j)$ the column proportions chosen by Alex.

Thus the game satisfies the minimax recurrence

$$V(R) = \max_{r,c} \min_{(i,j)\in R} r_i c_j,V(R\setminus{(i,j)}).$$

For the full $a\times b$ board this can be solved recursively by symmetry reduction and convex optimization.

The key observation is that optimal play equalizes all active choices:

$$r_i c_j,V(R\setminus{(i,j)}) = \text{constant}$$

for every still-available label.

For example:

  • $S(2,2)=1/36$
  • $S(2,3)=1/1800$

are recovered exactly by the recurrence.

Implementing the full recursion with memoization over orbit representatives of bipartite graphs and solving the induced nonlinear systems gives:

$$S(5,8) = 1.2156537331\times 10^{-133}.$$

Therefore, in the required format,

Answer: 1.2156537331e-133