Project Euler Lab - Problem 736

#736 - Paths to Equality

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

Define two functions on lattice points:

\(r(x,y) = (x+1,2y)\)
\(s(x,y) = (2x,y+1)\)

A path to equality of length \(n\) for a pair \((a,b)\) is a sequence \(\Big((a_1,b_1),(a_2,b_2),\ldots,(a_n,b_n)\Big)\), where:

  • \((a_1,b_1) = (a,b)\)
  • \((a_k,b_k) = r(a_{k-1},b_{k-1})\) or \((a_k,b_k) = s(a_{k-1},b_{k-1})\) for \(k > 1\)
  • \(a_k \ne b_k\) for \(k < n\)
  • \(a_n = b_n\)

\(a_n = b_n\) is called the final value.

For example,

\((45,90)\xrightarrow{r} (46,180)\xrightarrow{s}(92,181)\xrightarrow{s}(184,182)\xrightarrow{s}(368,183)\xrightarrow{s}(736,184)\xrightarrow{r}\)
\((737,368)\xrightarrow{s}(1474,369)\xrightarrow{r}(1475,738)\xrightarrow{r}(1476,1476)\)

This is a path to equality for \((45,90)\) and is of length 10 with final value 1476. There is no path to equality of \((45,90)\) with smaller length.

Find the unique path to equality for \((45,90)\) with smallest odd length. Enter the final value as your answer.

This problem is taken from Project Euler, Problem 736.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=736. Published Sunday, 29th November 2020, 01:00 am. Solved by 268 members at time of mirroring.

Why this is useful

Algorithmic Development. Graph/state-space search transfers to routing, dependency resolution, and execution-path optimisation (Phases 16, 17).

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.