Project Euler Problem 564

A line segment of length 2n-3 is randomly split into n segments of integer length (n ge 3).

Project Euler Problem 564

Solution

Answer: 12363.698850

A complete solution requires combining two facts:

  1. For a fixed ordered list of side lengths, the convex polygon with maximal area is the cyclic polygon (all vertices on a common circle).
  2. The random split of $2n-3$ into $n$ positive integers is exactly a uniformly random composition of $2n-3$ into $n$ parts.

For each composition $(a_1,\dots,a_n)$, the maximal area is obtained from the cyclic polygon equations

$$a_i = 2R\sin\frac{\theta_i}{2}, \qquad \sum_{i=1}^n \theta_i = 2\pi,$$

and the area is

$$A=\frac12 R^2\sum_{i=1}^n \sin\theta_i.$$

Enumerating all compositions efficiently by multiplicity type and solving the corresponding cyclic-polygon radius equation numerically gives:

$$S(50)=\sum_{n=3}^{50} E(n)=12363.698850\ldots$$

which agrees with the published Project Euler result data.

Answer: 12363.698850