Project Euler Lab - Problem 880

#880 - Nested Radicals

● ResearchOfficial difficulty: 76%DivisibilityTier D - conceptual / notebook executionNot viewed
↖ Euler Lab

\((x,y)\) is called a nested radical pair if \(x\) and \(y\) are non-zero integers such that \(\dfrac{x}{y}\) is not a cube of a rational number, and there exist integers \(a\), \(b\) and \(c\) such that:

\[\sqrt{\sqrt[3]{x}+\sqrt[3]{y}}=\sqrt[3]{a}+\sqrt[3]{b}+\sqrt[3]{c}\]

For example, both \((-4,125)\) and \((5,5324)\) are nested radical pairs:

\[ \begin{align*} \begin{split} \sqrt{\sqrt[3]{-4}+\sqrt[3]{125}} &= \sqrt[3]{-1}+\sqrt[3]{2}+\sqrt[3]{4}\\ \sqrt{\sqrt[3]{5}+\sqrt[3]{5324}} &= \sqrt[3]{-2}+\sqrt[3]{20}+\sqrt[3]{25}\\ \end{split} \end{align*} \]

Let \(H(N)\) be the sum of \(|x|+|y|\) for all the nested radical pairs \((x, y)\) where \(|x| \leq |y|\leq N\).
For example, \(H(10^3)=2535\).

Find \(H(10^{15})\). Give your answer modulo \(1031^3+2\).

This problem is taken from Project Euler, Problem 880.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=880. Published Saturday, 2nd March 2024, 07:00 pm. Solved by 137 members at time of mirroring.

Why this is useful

Mathematical Foundation. Exact integer reasoning and algorithmic efficiency. Foundational rigour and computational discipline rather than a direct trading application.

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 D - conceptual / notebook execution
Too heavy for browser Pyodide at original scale: the browser is used for planning, small cases and reasoning; full scale runs 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.