Project Euler Lab - Problem 514

#514 - Geoboard Shapes

● ResearchOfficial difficulty: 93%PointsTier C - reduced scale in browser; full scale in notebookNot viewed
↖ Euler Lab

A geoboard (of order \(N\)) is a square board with equally-spaced pins protruding from the surface, representing an integer point lattice for coordinates \(0 \le x, y \le N\).

John begins with a pinless geoboard. Each position on the board is a hole that can be filled with a pin. John decides to generate a random integer between \(1\) and \(N+1\) (inclusive) for each hole in the geoboard. If the random integer is equal to \(1\) for a given hole, then a pin is placed in that hole.

After John is finished generating numbers for all \((N+1)^2\) holes and placing any/all corresponding pins, he wraps a tight rubberband around the entire group of pins protruding from the board. Let \(S\) represent the shape that is formed. \(S\) can also be defined as the smallest convex shape that contains all the pins.

0514_geoboard.png

The above image depicts a sample layout for \(N = 4\). The green markers indicate positions where pins have been placed, and the blue lines collectively represent the rubberband. For this particular arrangement, \(S\) has an area of \(6\). If there are fewer than three pins on the board (or if all pins are collinear), \(S\) can be assumed to have zero area.

Let \(E(N)\) be the expected area of \(S\) given a geoboard of order \(N\). For example, \(E(1) = 0.18750\), \(E(2) = 0.94335\), and \(E(10) = 55.03013\) when rounded to five decimal places each.

Calculate \(E(100)\) rounded to five decimal places.

This problem is taken from Project Euler, Problem 514.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=514. Published Sunday, 3rd May 2015, 04:00 am. Solved by 271 members at time of mirroring.

Learning mode

Pick how much scaffolding you want. Your choice is remembered per problem.

Scratchpad

Mathematical notes, formulas, pseudocode, hypotheses, complexity notes. Saved automatically with your progress.

Python workbench

Tier C - reduced scale in browser; full scale in notebook
Browser runs a reduced, clearly-labelled educational scale; the original scale is provided in a local notebook.

Real Python (Pyodide) in a sandboxed Web Worker - no network, no filesystem, no DOM access. Ctrl/Cmd+Enter runs. Escape leaves the editor. Stop terminates the worker.

Python runtime not loaded (it boots on first run - a one-time local load).

Check your answer

Answers are checked against a salted hash held in a separate file - not printed in this page. This prevents accidental spoilers; it is not cryptographic protection (see the build notes).

Progressive hints

Confidence

Low confidence schedules this problem for spaced review, even if you solved it.

Reference solution

Spoiler
The complete original explanation (interpretation, naive approach, insight, proof, complexity, Python implementation, tests, common mistakes, alternatives) is hidden and lazy-loaded. Reveal it only after a meaningful attempt - the struggle is where the learning happens.