OFFSET
1,2
REFERENCES
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.
I. Vardi, "The Condom Problem." Ch. 10 in Computational Recreations in Mathematica. Redwood City, CA: Addison-Wesley, pp. 203-222, 1991.
LINKS
Nathaniel Johnston, Rows n=1..150, flattened
Ilan Vardi, The condom problem
Eric Weisstein's World of Mathematics, Glove Problem.
FORMULA
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.
EXAMPLE
The triangle begins:
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
...
MAPLE
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
MATHEMATICA
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 *)
CROSSREFS
KEYWORD
AUTHOR
Jonathan Vos Post, Jan 31 2009
EXTENSIONS
Edited by Nathaniel Johnston, May 03 2011
STATUS
approved