Project Euler Lab - Problem 969

#969 - Kangaroo Hopping

● AdvancedOfficial difficulty: 53%PolynomialsTier C - reduced scale in browser; full scale in notebookNot viewed
↖ Euler Lab

Starting at zero, a kangaroo hops along the real number line in the positive direction. Each successive hop takes the kangaroo forward a uniformly random distance between \(0\) and \(1\). Let \(H(n)\) be the expected number of hops needed for the kangaroo to pass \(n\) on the real line.

If we write \(\alpha = H(1)\), then for all positive integers \(n\), \(H(n)\) can be expressed as a polynomial function of \(\alpha\) with rational coefficients. For example \(H(3)=\alpha^3-2\alpha^2+\frac{1}{2}\alpha\). Define \(S(n)\) to be the sum of all integer coefficients in this polynomial form of \(H(n)\). Therefore \(S(1)=1\) and \(S(3)=1+(-2)=-1\).
You are also given \(\displaystyle \sum_{n=1}^{10} S(n)=43\).
Find \(\displaystyle\sum_{n=1}^{10^{18}} S(n)\). Give your answer modulo \(10^9+7\).

This problem is taken from Project Euler, Problem 969.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=969. Published Sunday, 16th November 2025, 04:00 am. Solved by 264 members at time of mirroring.

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.