1
$\begingroup$

Let p(n) be the number of unrestricted partitions of n. p(0) is taken to be 1. Let set 1 and set 2 be two empty sets.

Here's an algorithm. Put p(n) into set 1. On each successive step, k=1,2,3,..., n, put p(n-k) into that set which has the smaller sum of elements, or into set 1 if the two sets have equal sums.

After the algorithm has ended will the sum of elements in set 1 always differ from the sum of elements in set 2 by at most 1?

I've checked for n<= 200 and this has always been the case.

$\endgroup$

1 Answer 1

3
$\begingroup$

Let a nondecreasing sequence (we'll say of positive integers) $a_n$ starting from $a_1=1$ be subdoubling if for all $n>2$ it satisfies the relation $a_n <= 2*a_{n-1}$. Let $d$ be an integer with $-a_n \leq d \leq a_n$ and put $d$ in set 2, then run your algorithm. I claim at the finish of the algorithm the difference between the sums is at most $a_1=1$.

Proof Sketch: at the start the difference between the two sums is $\left| d \right| \leq a_n$.
Because of the subdoubling property, the difference when $a_{n-1}$ is added at most $a_{n-1}$. End of Proof Sketch.

Corollary: Given $-2*a_n\leq d \leq 2*a_n$, you can choose coefficients $\epsilon_i$ from $\{-1,+1\}$ so that $\sum_i \epsilon_i * a_i$ is within one of $d$.

If I recall correctly, your sequence $a_n$ is subdoubling. So you will end up with 1 even if you pad set 2 with a small enough value.

I used something like this for the determinant spectrum problem for $0-1$ matrices.

Gerhard "Ah, The Good Old Days" Paseman, 2016.08.27

$\endgroup$
1
  • $\begingroup$ By the way, this would make a nice exercise for a discrete math/ intro to algorithms class. I hope this did not come from a homework set. Gerhard "Almost Always, Motivation Is Relevant" Paseman, 2016.08.27. $\endgroup$ Commented Aug 27, 2016 at 18:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .