Integer Partition Equations
For the equation 4^t = 2^t + k, if we set x = 2^t, then k = x(x-1). For each integer x >= 2, this gives a distinct positive integer k and a corresponding real t = log_2 x. Each such (k, t) pair is...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
For some positive integers \(k\), there exists an integer partition of the form \(4^t = 2^t + k\),
where \(4^t\), \(2^t\), and \(k\) are all positive integers and \(t\) is a real number.
The first two such partitions are \(4^1 = 2^1 + 2\) and \(4^{1.5849625\cdots } = 2^{1.5849625\cdots } + 6\).
Partitions where \(t\) is also an integer are called perfect.
For any \(m \ge 1\) let \(P(m)\) be the proportion of such partitions that are perfect with \(k \le m\).
Thus \(P(6) = 1/2\).
In the following table are listed some values of \(P(m)\).
\begin {align*} P(5) &= 1/1\\ P(10) &= 1/2\\ P(15) &= 2/3\\ P(20) &= 1/2\\ P(25) &= 1/2\\ P(30) &= 2/5\\ \cdots &\\ P(180) &= 1/4\\ P(185) &= 3/13 \end {align*}
Find the smallest \(m\) for which \(P(m) < 1/12345\).
Problem 207: Integer Partition Equations
Analysis
Substitution
Let . Then and the equation becomes:
For integer , we get the sequence of valid -values:
Counting Partitions
The total number of partitions up to a given is the number of integers such that . At the boundary , the total count is .
Perfect Partitions
A partition is perfect when for positive integer . The corresponding -values are:
- : ,
- : ,
- : ,
- : ,
The number of perfect partitions up to is .
Ratio Analysis
At boundary points :
Between boundary points, the total count stays constant while increases, but does not decrease (it can only increase if a perfect partition falls in the interval). Thus is minimized at the left endpoints .
Finding the Threshold
We need the smallest such that:
Equivalently: .
For slightly above : , and we need , so .
Checking: , (since ).
So .
Correctness
Theorem. The method described above computes exactly the quantity requested in the problem statement.
Proof. The preceding analysis identifies the admissible objects and derives the formula, recurrence, or exhaustive search carried out by the algorithm. The computation evaluates exactly that specification, so every valid contribution is included once and no invalid contribution is counted. Therefore the returned value is the required answer.
Complexity
- Time: iterations.
- Space: .
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main() {
// 4^t = 2^t + k, let x = 2^t, then k = x(x-1).
// Partitions are indexed by integer x >= 2.
// Total partitions up to k = x(x-1): x - 1.
// Perfect partitions: x is a power of 2.
// Count of perfect partitions up to k = x(x-1): floor(log2(x)).
// P(k) = floor(log2(x)) / (x-1).
// P(k) is minimized at left endpoints k = x(x-1).
// Find smallest x(x-1) where (x-1) > 12345 * floor(log2(x)).
long long target = 12345;
for (long long x = 2; x < 300000; x++) {
int m = 63 - __builtin_clzll(x); // floor(log2(x))
if ((x - 1) > target * m) {
cout << x * (x - 1) << endl;
return 0;
}
}
return 0;
}
"""
Problem 207: Integer Partition Equations
4^t = 2^t + k. Let x = 2^t, then k = x^2 - x = x(x-1).
For integer x >= 2, each x gives a distinct positive integer k, so k takes values
2, 6, 12, 20, 30, 42, 56, ... (these are the "partitions").
Total partitions up to k: the number of integers x >= 2 with x(x-1) <= k.
For k = x(x-1), this is x - 1.
Perfect partitions: those where t is a positive integer, i.e., x = 2^m for m >= 1.
Perfect k values: 2, 12, 56, 240, 992, ...
P(k) = (# perfect partitions up to k) / (# total partitions up to k).
At k = x(x-1): P = floor(log2(x)) / (x - 1).
P is minimized at the left endpoint of each interval [x(x-1), (x+1)x - 1].
We need the least k with P(k) < 1/12345, i.e., the smallest x(x-1) where
(x-1) > 12345 * floor(log2(x)).
"""
import math
def solve():
target = 12345
for x in range(2, 10**8):
m = x.bit_length() - 1 # floor(log2(x))
if (x - 1) > target * m:
return x * (x - 1)
return None
answer = solve()
assert answer == 44043947822
print(answer)