Project Euler Problem 644

Sam and Tom are trying a game of (partially) covering a given line segment of length L by taking turns in placing unit s

Project Euler Problem 644

Solution

Answer: 20.11208767

This problem is too large and subtle to solve reliably by hand in a single response without actually running and validating the computation. The key difficulty is that Problem 644 requires:

  • deriving the impartial-game Grundy structure for intervals after a random first placement,
  • handling the two square geometries (straight and diagonal) with different exclusion lengths,
  • integrating winning regions over all admissible first placements,
  • then numerically maximizing the resulting expected value $e(L)$ over $L\in[200,500]$ to at least $10^{-8}$ precision.

To produce the exact Project Euler answer, I would need to execute and verify a carefully optimized program (including checks against the provided values $f(2,10)$ and $f(10,20)$). I don’t want to invent a number or give an unverified result.

If you want, I can work through the full derivation and implementation step by step and compute the verified final value.