login
Triangle read by rows containing Vardi's optimal solution to the glove problem.
1

%I #24 Dec 28 2022 15:42:28

%S 1,2,2,2,3,4,3,4,4,5,3,4,5,6,6,4,5,5,6,7,7,4,5,6,7,7,8,9,5,6,6,7,8,8,

%T 9,10,5,6,7,8,8,9,10,10,11,6,7,7,8,9,9,10,11,11,12,6,7,8,9,9,10,11,11,

%U 12,13,13,7,8,8,9,10,10,11,12,12,13,14,14,7

%N Triangle read by rows containing Vardi's optimal solution to the glove problem.

%D A. Hajnal and L. Lovasz, "An Algorithm to Prevent the Propagation of Certain Diseases at Minimum Cost." Section 10.1 in Interfaces Between Computer Science and Operations Research: Proceedings of a Symposium Held at the Mathematisch Centrum, Amsterdam, September 7-10, 1976 (Ed. J. K. Lenstra, A. H. G. Rinnooy Kan and P. van Emde Boas). Amsterdam: Matematisch Centrum, 1978.

%D I. Vardi, "The Condom Problem." Ch. 10 in Computational Recreations in Mathematica. Redwood City, CA: Addison-Wesley, pp. 203-222, 1991.

%H Nathaniel Johnston, <a href="/A155940/b155940.txt">Rows n=1..150, flattened</a>

%H Ilan Vardi, <a href="http://www.mathematik.uni-bielefeld.de/~sillke/PUZZLES/condoms-n-m">The condom problem</a>

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/GloveProblem.html">Glove Problem</a>.

%F a(m,n) = 2 when m = n = 2. a(m,n) = (m+1)/2 when n = 1 and m is odd. a(m,n) = ceiling((m/2) + (2*n/3)) otherwise.

%e The triangle begins:

%e 1

%e 2 2

%e 2 3 4

%e 3 4 4 5

%e 3 4 5 6 6

%e 4 5 5 6 7 7

%e 4 5 6 7 7 8 9

%e ...

%p A155940 := proc(m,n) if(n=2 and m=2)then return 2: elif(n=1 and m mod 2 = 1)then return (m+1)/2: else return ceil((m/2) + (2*n/3)): fi: end: for m from 1 to 7 do seq(A155940(m,n),n=1..m); od; # _Nathaniel Johnston_, May 03 2011

%t vos[{m_,n_}]:=Which[m==n==2,2,n==1&&OddQ[m],(m+1)/2,True,Ceiling[ m/2+2 n/3]]; Flatten[Table[vos[{m,n}],{m,20},{n,m}]] (* _Harvey P. Dale_, Jun 10 2013 *)

%K easy,nonn,tabl

%O 1,2

%A _Jonathan Vos Post_, Jan 31 2009

%E Edited by _Nathaniel Johnston_, May 03 2011