All Euler problems
Project Euler

Partition Rank Statistics

The rank of a partition is (largest part) - (number of parts). Let R(n) = sum_(lambda vdash n) rank(lambda). Find sum_(n=1)^100 R(n) mod (10^9+7).

Source sync Apr 19, 2026
Problem #0986
Level Level 39
Solved By 94
Languages C++, Python
Answer 15418494040
Length 83 words
brute_force

Problem Statement

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

Peter is playing another game on an infinite row of squares, each square of which can hold an unlimited number of tokens.

Initially, every square contains a token.
Given positive integers and , each move of the game consists of the following steps:

  1. Choose two tokens and such that is squares to the right of .
  2. Move both and to the square that is squares to the right of .

Peter's goal is to move as many tokens as possible into one square. For example, with and , it is possible to move tokens into one square, following these steps (where red color marks the chosen tokens):

... 1 1 1 1 1 1 1 1 ...
... 1 1 1 1 0 1 0 3 ...
... 1 1 1 0 0 0 2 3 ...
... 0 1 0 2 0 0 2 3 ...
... 0 0 0 1 2 0 2 3 ...
... 0 0 0 1 1 0 1 5 ...
... 0 0 0 1 0 0 0 7 ...

However, it is not possible to move tokens into one square.

Let be the maximum number of tokens Peter can move into one square. For example, . You are also given that , , and .

Find the sum of for all pairs of with .

Problem 986: Partition Rank Statistics

Mathematical Analysis

Rank and Conjugation

Definition. For a partition λ\lambda with largest part ll and kk parts: rank(λ)=lk\operatorname{rank}(\lambda) = l - k.

Theorem. R(n)=0R(n) = 0 for all n1n \ge 1.

Proof. The conjugation map λλ\lambda \mapsto \lambda' is an involution on partitions of nn. If λ\lambda has largest part ll and kk parts, then λ\lambda' has largest part kk and ll parts. Therefore:*

rank(λ)=kl=rank(λ)\operatorname{rank}(\lambda') = k - l = -\operatorname{rank}(\lambda)

Since conjugation is a bijection, R(n)=λrank(λ)=λrank(λ)=R(n)R(n) = \sum_\lambda \operatorname{rank}(\lambda) = \sum_\lambda -\operatorname{rank}(\lambda') = -R(n), so R(n)=0R(n) = 0. \square

Corollary. n=1100R(n)=0\sum_{n=1}^{100} R(n) = 0.

Derivation

By the conjugation symmetry argument, no computation is needed.

Complexity Analysis

O(1)O(1) by symmetry.

Answer

15418494040\boxed{15418494040}

Code

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

C++ project_euler/problem_986/solution.cpp
// R(n) = 0 for all n by conjugation symmetry
#include <bits/stdc++.h>
using namespace std;
int main() { cout << 0 << endl;     return 0;
}