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.
LINKS
Andrew Howroyd, Faster PARI Program
EXAMPLE
For n = 3, {3, 6, 19} is the set with the smallest sum that has this property. With 3 socks of one color, 6 socks of another color, and 19 socks of a third color, there is exactly a 50% chance that a random draw of two socks will produce a matching pair. (3*2 + 6*5 + 19*18) = (28*27) / 2.
n = 2, sum = 9, set = {3, 6}
n = 3, sum = 28, set = {3, 6, 19}
n = 4, sum = 41, set = {2, 3, 8, 28}
n = 5, sum = 65, set = {2, 4, 6, 8, 45}
n = 6, sum = 85, set = {2, 3, 5, 6, 10, 59}
PROG
(PARI) \\ See Links for a faster program.
a(n)={for(k=(n+1)*(n+2)/2-1, oo, my(t=k*(k-1)/2); forpart(p=k-n*(n+1)/2, if(sum(i=1, n, (p[i]+i)*(p[i]+i-1))==t, return(k)), , [n, n]))} \\ Andrew Howroyd, Nov 20 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Dean D. Ballard, Nov 20 2020
EXTENSIONS
a(13)-a(50) from Andrew Howroyd, Nov 22 2020
STATUS
approved