Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

I've been searching for the answer for many years, both by researching by myself and reading about the subject. Now I'm wondering if this has a solution.

The problem can be stated as follows.

Given a M x N grid of points, how many triangles with vertices in the grid can be formed? Note that you can't select two points that coincide or three collinear points because that wouldn't conform a triangle (area would be 0)

OK, I know a bit of programming and could manage to code a program that solves this, but would REALLY like to know if there is a general form depending on M and N. I suspect it has to do with prime numbers... (Perhaps I totally missed heheh)

Thanks for your time! Manuel

share|improve this question
2  
The answer is given by taking an appropriate binomial coefficient and then subtracting the number of colinear three-point configurations. –  Steve Huntsman Feb 15 '10 at 14:39
2  
Yeah, the thing is how many collinear three-point configurations to subtract. That's the real challenge. Think about it for a moment and you'll realize this is not as trivial as it may seem. –  Manuel Feb 15 '10 at 17:19
    
The question is equivalent to count the collinear triples, for which it is not hard to write up a summation but I donno whether an explicit formula would exist. –  domotorp Feb 15 '10 at 17:48
    
I added the number-theory tag, as this is more of a number theory problem than a combinatorial one. –  Douglas Zare Feb 16 '10 at 8:27

2 Answers 2

For the NxN case, at least, there is a literature. An entry point is sequence A000938 in the On-Line Encyclopedia of Integer Sequences.

share|improve this answer

ok here is one answer, but I think, you already knew that:

so there are $\left((M+1)(N+1)\atop 3\right)$ possible triangles an we have to subtract the number of triangles, which are degenerated. Every degenerated triangle is given by a choice of 2 points $P=(x,y),P'=(x',y')$ and a choice of a lattice point on the segment from $P$ to $P'$. Let $R:=gcd(x-x',y-y')$. There should be exactly $R+1$ points on that line, so we get at least a method, how a computer programme could compute that number.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.