Project Euler Lab - Problem 295

#295 - Lenticular Holes

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

We call the convex area enclosed by two circles a lenticular hole if:

  • The centres of both circles are on lattice points.
  • The two circles intersect at two distinct lattice points.
  • The interior of the convex area enclosed by both circles does not contain any lattice points.

Consider the circles:
\(C_0\): \(x^2 + y^2 = 25\)
\(C_1\): \((x + 4)^2 + (y - 4)^2 = 1\)
\(C_2\): \((x - 12)^2 + (y - 4)^2 = 65\)

The circles \(C_0\), \(C_1\) and \(C_2\) are drawn in the picture below.

0295_lenticular.gif

\(C_0\) and \(C_1\) form a lenticular hole, as well as \(C_0\) and \(C_2\).

We call an ordered pair of positive real numbers \((r_1, r_2)\) a lenticular pair if there exist two circles with radii \(r_1\) and \(r_2\) that form a lenticular hole. We can verify that \((1, 5)\) and \((5, \sqrt{65})\) are the lenticular pairs of the example above.

Let \(L(N)\) be the number of distinct lenticular pairs \((r_1, r_2)\) for which \(0 \lt r_1 \le r_2 \le N\).
We can verify that \(L(10) = 30\) and \(L(100) = 3442\).

Find \(L(100\,000)\).

This problem is taken from Project Euler, Problem 295.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=295. Published Saturday, 5th June 2010, 01:00 pm. Solved by 565 members at time of mirroring.

Why this is useful

Optimization. The transferable skill is replacing infeasible enumeration with a mathematical reduction - the core move in calibration and large-scale computation (Phases 10, 13).

We classify relevance honestly - not every Euler problem is a trading application.

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.