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
Mathematical Development
Substitution
Let . Then , so
For integer , the admissible values of are therefore
Counting Partitions
At the boundary value , the total number of partitions counted by is exactly the number of integers with , namely .
Perfect Partitions
A partition is perfect precisely when is a power of 2. Thus the perfect values are generated by
and at the boundary the number of perfect partitions is
Ratio Analysis
Hence, for ,
As moves between two consecutive admissible values, neither the numerator nor the denominator changes, so the minimum is attained at one of these boundary points.
Finding the Threshold
We need
which is equivalent to
For , we require
so the first candidate is . This indeed satisfies , giving
Editorial
The substitution completely linearizes the problem. Instead of reasoning about real exponents, we only need to study the integer sequence . Up to the boundary value indexed by , there are exactly admissible partitions, and the perfect ones are exactly those with equal to a power of 2, so there are of them.
That means the ratio at a boundary point is just . The answer is therefore the first for which overtakes , and then we convert back to .
Pseudocode
target = 12345
x = 2
Repeat:
perfect_count = floor(log_2(x))
If x - 1 > target * perfect_count:
return x * (x - 1)
Increase x by 1
Complexity Analysis
- Time: , where is the first integer satisfying the threshold inequality.
- 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)