OFFSET
2,1
COMMENTS
These numbers solve the problem of what is the required minimum number of socks of n colors such that a random drawing of two socks has a 50% chance of matching. In this version there may be a color with only one sock, and the number of socks of each color need not be distinct.
If the set solving a(n)=k has three 2's, then a(n+1)<=k, replacing them with one 3 and three 1's; this leads to many repeats in the data. Similar substitutions include {4, 5} for {1, 2, 6}, {3, 3, 4} for {1, 2, 2, 5}, and {3, 3} for {1, 1, 4}. - Dean D. Ballard and Michael S. Branicky, Nov 30 2020
EXAMPLE
For n = 4, {1, 2, 2, 12} is the set with the smallest sum that has this property. With 1 sock of one color, 2 socks of a second color, 2 socks of a third color, and 12 socks of a fourth color, there is exactly a 50% chance that a random draw of two socks will produce a matching pair. (1*0 + 2*1 + 2*1 + 12*11) = (17*16) / 2.
n = 2, sum = 4, set = {1, 3}
n = 3, sum = 13, set = {1, 3, 9}
n = 4, sum = 17, set = {1, 2, 2, 12}
n = 5, sum = 40, set = {3, 3, 3, 3, 28}
n = 6, sum = 24, set = {1, 1, 1, 2, 2, 17}
PROG
(PARI) \\ See 'Faster PARI Program' link in A246750 for PartsByWeight.
a(n)={local(FC=Map()); for(k=1, oo, if(PartsByWeight(n, k, k*(k-1)/2, (i, v)->v*(v-1)), return(k))); oo} \\ Andrew Howroyd, Nov 30 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Dean D. Ballard, Nov 29 2020
EXTENSIONS
a(26)-a(70) from Andrew Howroyd, Nov 30 2020
STATUS
approved
