Project Euler Lab - Problem 841

#841 - Regular Star Polygons

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

The regular star polygon \(\{p/q\}\), for coprime integers \(p,q\) with \(p \gt 2q \gt 0\), is a polygon formed from \(p\) edges of equal length and equal internal angles, such that tracing the complete polygon wraps \(q\) times around the centre. For example, \(\{8/3\}\) is illustrated below:

{8/3}

The edges of a regular star polygon intersect one another, dividing the interior into several regions. Define the alternating shading of a regular star polygon to be a selection of such regions to shade, such that every piece of every edge has a shaded region on one side and an unshaded region on the other, with the exterior of the polygon unshaded. For example, the above image shows the alternating shading (in green) of \(\{8/3\}\).

Let \(A(p, q)\) be the area of the alternating shading of \(\{p/q\}\), assuming that its inradius is \(1\). (The inradius of a regular polygon, star or otherwise, is the distance from its centre to the midpoint of any of its edges.) For example, in the diagram above, it can be shown that central shaded octagon has area \(8(\sqrt{2}-1)\) and each point's shaded kite has area \(2(\sqrt{2}-1)\), giving \(A(8,3) = 24(\sqrt{2}-1) \approx 9.9411254970\).

You are also given that \(A(130021, 50008)\approx 10.9210371479\), rounded to \(10\) digits after the decimal point.

Find \(\sum_{n=3}^{34} A(F_{n+1},F_{n-1})\), where \(F_j\) is the Fibonacci sequence with \(F_1=F_2=1\) (so \(A(F_{5+1},F_{5-1}) = A(8,3)\)). Give your answer rounded to \(10\) digits after the decimal point.

This problem is taken from Project Euler, Problem 841.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=841. Published Sunday, 30th April 2023, 05:00 am. Solved by 221 members at time of mirroring.

Why this is useful

Numerical Computing. Precision, conditioning, and numerical iteration transfer directly to pricing engines and model calibration (Phases 5, 13, 15).

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.