Consider a permutation of the positive integers up to . This permutation is streamed one item () at a time to an observer (you!). After observing an item, you must make two choices. First, choose whether to add to a working set () or discard . Second, choose whether to observe an additional value or stop observing subsequent items.
Once you’ve stopped the stream, a (non-adversarial) wizard chooses an integer on . Your goal is to find some such that . A good algorithm should:
Clearly, we could view the entire stream, store all items so that = , and succeed all the time because . Can we do better though?
I propose that we include the first items in . The subsets of have sums that aren’t uniformly distributed, but when is applied this distribution becomes near uniform on . If this distribution is in-fact uniform, then we have a success probability of .
— This result re: comes from Sampling Correctors: Section 8.1. To be quite honest, I think the exact problem (i.e. sum must be instead of with ) is more interesting, but I liked that fact so we shoehorn it in. This post was inspired by of Jay Cummings’ . In that problem, we see (via. pigeonhole principle) that for any subset of size there is at least one positive integer that can be constructed by at least two subsets of .