AOk, thanks a lot. I'll give it a try. ;)
tWell, it's a matter of using some simple formulas:
Let's make z = number of int points on a diagonal = gcd(n, m).
Then, the number of points strictly inside is ((n-1)*(m-1)-z)/2, while the number of points on the vertices is n+m+z+1. Add those two and you have the answer ;).
AThanks, I can't find number of point at the diagonal. ;)
pTry looking for geometric meaning of GCD of two numbers. that may help
vSo what is the geometric meaning of GCD?
oVasja, try to solve this alone, search at internet, draw some cases
9 15
5 7
2 8
maybe then you understand this geometric meaning
vOK i see through examples that the number of integer coordinates on the diagonal is GCD(n,m)+1 (including the end points) but i still don't understand why is that so?
Some tutorial on this maybe?
tThis is quite useful I think.
pGeometric meaning of GCD
gcd(a,b) represents the number of integer points along 1,1 to a,b or b.a
so now in a rectangle from 0,0 to a,b
imagine it to be a two triangles joined
u have (1+a)*(1+b) points in the rectangle
subtract this by gcd(a,b) + 1 (1 for 0,0)
now divide this by 2 since there are two triangles and they are symmetric
this gives the points on the triangle but not on the diagonal
so add gcd(a,b) to this to get the answer
cheers, sorry for late reply