OFFSET

2,1

COMMENTS

These numbers solve the problem of what is the required minimum even number of socks of n colors such that a random drawing of two socks has a 50% chance of matching.

EXAMPLE

For n = 3, {6, 48, 90} is the set of even numbers with the smallest sum that has this property. With 6 socks of one color, 48 socks of another color, and 90 socks of a third color, there is exactly a 50% chance that a random draw of two socks will produce a matching pair. (6*5 + 48*47 + 90*89) = (144*143) / 2.

n = 2, sum = 16, set = {6, 10}

n = 3, sum = 144, set = {6, 48, 90}

n = 4, sum = 80, set = {2, 8, 16, 54}

n = 5, sum = 96, set = {2, 6, 8, 14, 66}

n = 6, sum = 160, set = {2, 6, 8, 10, 24, 110}

PROG

(PARI) \\ See Links in A246750 for a faster program.

a(n)={for(k=n*(n+1)/2, oo, my(t=k*(4*k-1)); forpart(p=2*k-n*(n-1)/2, if(sum(i=1, n, (p[i]+i-1)*(2*(p[i]+i-1)-1))==t, return(4*k)), , [n, n]))} \\ Andrew Howroyd, Nov 21 2020

CROSSREFS

KEYWORD

nonn

AUTHOR

Dean D. Ballard, Nov 20 2020

EXTENSIONS

a(16)-a(50) from Andrew Howroyd, Nov 22 2020

STATUS

approved