[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference rusure::math

Title:Mathematics at DEC
Moderator:RUSURE::EDP
Created:Mon Feb 03 1986
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2083
Total number of notes:14613

1211.0. "triangle counting" by HERON::BUCHANAN (combinatorial bomb squad) Thu Mar 22 1990 07:46

How many triangles are there where each side has length a positive integer,
and the perimeter is n?   ([3,4,5] & [3,5,4] & [4,5,3] are all the same 
triangle.)

Regards,
Andrew.
T.RTitleUserPersonal
Name
DateLines
1211.1ALLVAX::JROTHIt's a bush recording...Thu Mar 22 1990 10:1819
    The exact number may be a difficult question in additive number theory...

    The (a,b,c) lengths will be integer lattice points lying on the
    plane a+b+c = n and satisfying the further inequalities

	a,b,c > 0   positive lengths lie in equilateral triangle in plane
        c < a+b	    triangle inequality

	a <= b
	a <= c
	b <= c	    make the triangle unique up to symmetry

    It shouldn't be hard to have an asymptotic estimate of the number of
    triangles, since the limiting density of lattice points in the
    plane a+b+c = n should be easy to estimate, (I don't know the number
    offhand) and the bounds could be used to compute the area of the subset
    we're interested in.

    - Jim
1211.2ALLVAX::JROTHIt's a bush recording...Thu Mar 22 1990 11:1014
    I tried a simple minded program and it seems that
    log(k)/log(n) ~= 1.4 or so; this doesn't make sense, since the density
    of lattice points in a plane x+y+z = n is proprortional to n^2
    (the constant is about .5771).  If the points were equidistributed
    then only 1/6 of them would be our triangles on account of the
    inequalities and symmetry.

    The density of lattice points in the plane must not be uniform.

    I may try plotting the pattern and see if it looks interesting.

    fwiw, for n = 20000 I saw 8333333 unique triangles.

    - Jim
1211.31/6 done?IOSG::CARLINDick Carlin IOSGThu Mar 22 1990 14:5510
    Is it really that difficult? I calculate that for
    
    	n = 12*m		k = 3*m^2
    
    	n = 12*m+6		k = 3*m*(m+1)+1
    
    and the other 5/6 should be similar. On the other hand I could be wrong
    as I'm rushing to do this before my ALL-IN-1 link completes.
    
    dick
1211.4ALLVAX::JROTHIt's a bush recording...Thu Mar 22 1990 15:2620
    Yes, my face should be red for making it overly complex...

    The cases could be tabulated as:

	    n		    k
	----------	------------------
	 12*m		  3*m^2
	 12*m + 1	  3*m^2 + 2*m
         12*m + 2	  3*m^2 + m
	 12*m + 3	  3*m^2 + 3*m + 1
	 12*m + 4	  3*m+2 + 2*m
	 12*m + 5	  3*m+2 + 4*m + 1
	 12*m + 6	  3*m+2 + 3*m + 1
	 12*m + 7	  3*m+2 + 5*m + 2
	 12*m + 8	  3*m+2 + 4*m + 1
	 12*m + 9	  3*m+2 + 6*m + 3
	 12*m + 10	  3*m^2 + 5*m + 2
	 12*m + 11	  3*m^2 + 7*m + 4

    - Jim
1211.5yes, that's itHERON::BUCHANANcombinatorial bomb squadFri Mar 23 1990 11:3396
1211.6ALLVAX::JROTHIt's a bush recording...Sun Apr 15 1990 14:589
    Here is an even simpler expression for the number

	n even:	floor((n^2+21)/48)
	n odd:  floor((n^2+6*n+21)/48)

    Actually, the problem would have been simpler if you hadn't required that
    congruent triangles be considered equivalent :-)

    - Jim