Project Euler Lab - Problem 772

#772 - Balanceable $k$-bounded Partitions

● AppliedOfficial difficulty: 19%CountingTier B - browser, with the efficient algorithmNot viewed
↖ Euler Lab

A \(k\)-bounded partition of a positive integer \(N\) is a way of writing \(N\) as a sum of positive integers not exceeding \(k\).

A balanceable partition is a partition that can be further divided into two parts of equal sums.

For example, \(3 + 2 + 2 + 2 + 2 + 1\) is a balanceable \(3\)-bounded partition of \(12\) since \(3 + 2 + 1 = 2 + 2 + 2\). Conversely, \(3 + 3 + 3 + 1\) is a \(3\)-bounded partition of \(10\) which is not balanceable.

Let \(f(k)\) be the smallest positive integer \(N\) all of whose \(k\)-bounded partitions are balanceable. For example, \(f(3) = 12\) and \(f(30) \equiv 179092994 \pmod {1\,000\,000\,007}\).

Find \(f(10^8)\). Give your answer modulo \(1\,000\,000\,007\).

This problem is taken from Project Euler, Problem 772.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=772. Published Saturday, 13th November 2021, 04:00 pm. Solved by 678 members at time of mirroring.

Why this is useful

Mathematical Foundation. Exact counting underlies discrete pricing lattices, scenario enumeration, and combinatorial probability (Phase 7).

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 B - browser, with the efficient algorithm
Runs in the browser only with the intended efficient algorithm; a naive loop will hit the timeout.

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.