
n and r are positive integers. Find the smallest k for which we can construct r subsets A1, A2, ... , Ar of {0, 1, 2, ... , n-1} each with k elements such that each integer 0 ≤ m < n can be written as a sum of one element from each of the r subsets.
Answer
smallest integer such that kr ≥ n.
Solution
We can form at most kr distinct sums, so kr must be ≥ n.
Now consider A1 = {0, 1, 2, ... , k-1}, A2 = {0, k, 2k, ... , (k-1)k}, A3 = {0, k2, 2k2, ... , (k-1)k2}, ... , Ar = {0, kr-1, 2kr-1, ... , (k-1)kr-1}. Then for any non-negative integer m < kr, we can write m with r digits in base k (using leading zeros as necessary) and hence as a sum of one element from each Ai. This subset works for (k-1)kr-1 < n ≤ kr. For smaller n above (k-1)r we cannot use all the elements given above, but we do not need them, so we just replace the elements which are too large by arbitrary elements under n.
For example, suppose n = 17, r = 4. We need k = 3. So we form A1 = {0, 1, 2}, A2 = {0, 3, 6}, A3 = {0, 9, 18}, A4 = {0, 27, 54}. Now 18, 27, 54 are unnecessary, so we pad out A3 and A4 with other elements. We could take A3 = {0, 1, 9}, A4 = {0, 1, 2}.
![]()
© John Scholes
jscholes@kalva.demon.co.uk
3 February 2004
Last corrected/updated 3 Feb 04