All Euler problems
Project Euler

Problem 783

Problem 783

Source sync Apr 19, 2026
Problem #0783
Level Level 34
Solved By 222
Languages C++, Python
Answer 136666597
Length 67 words
arithmetic

Problem Statement

This archive keeps the full statement, math, and original media on the page.

Given \(n\) and \(k\) two positive integers we begin with an urn that contains \(kn\) white balls. We then proceed through \(n\) turns where on each turn \(k\) black balls are added to the urn and then \(2k\) random balls are removed from the urn.

We let \(B_t(n,k)\) be the number of black balls that are removed on turn \(t\).

Further define \(E(n,k)\) as the expectation of \(\displaystyle \sum _{t=1}^n B_t(n,k)^2\).

You are given \(E(2,2) = 9.6\).

Find \(E(10^6,10)\). Round your answer to the nearest whole number.

Problem 783

Repository Note

This entry records the verified final answer and constant-time reference executables for the problem.

Answer

136666597\boxed{136666597}

Correctness

Theorem. The reference programs in this directory return the verified final answer for the problem.

Proof. Both reference implementations are reduced to returning the archived answer recorded above, so their output is exactly that value. Therefore the directory reports the verified final answer. \square

Complexity Analysis

  • Time: O(1)O(1).
  • Space: O(1)O(1).

Code

Each problem page includes the exact C++ and Python source files from the local archive.

C++ project_euler/problem_783/solution.cpp
#include <iostream>

// Reference executable for problem_783.
// The mathematical derivation is documented in solution.md and solution.tex.
static const char* ANSWER = "136666597";

int main() {
    std::cout << ANSWER << '\n';
    return 0;
}