I'm trying to show that Pick's theorem holds for any right triangle with vertices at the points $(0,0),(a,0),(0,b)$ with $a$ and $b$ both being positive integers.
I've managed to express the number of interior points as the sum $$\sum_{k=1}^{a-1} \left( \left\lceil k \frac{b}{a} \right\rceil-1 \right) ,$$ and the number of boundary points as $$a+b+\gcd(a,b). $$ Pick's theorem then suggests that $$\sum_{k=1}^{a-1} \left( \left\lceil k \frac{b}{a} \right\rceil-1 \right) +\frac{1}{2} \left( a+b+\gcd(a,b) \right) -1=\frac{ab}{2},$$ or equivalently $$\sum_{k=1}^{a-1} \left\lceil k\frac{b}{a} \right\rceil=\frac{a-b+ab-\gcd(a,b)}{2}.$$ I couldn't prove this equality is true. I've thought about using induction on either $a$ or $b$, but the $\gcd$ makes it difficult for me. Any thoughts on how to prove this would be welcome, Thanks!
P.S. Wikipedia suggests a similar identity for the floor function $$\sum_{k = 1}^{n - 1} \left\lfloor \frac{k m}{n} \right\rfloor = \frac{(m - 1)(n - 1)+\gcd(m,n)-1}2 ,$$ but I couldn't find a proof of that one either.
Call this triangle $T'$ The slick way to do this is to observe that the triangle $T'$ with vertices $(a,0)$, $(0,b)$ and $(a,b)$ has the same number of lattice points as $T$ (a bijection is $(x,y)\mapsto(a-x,b-y)$). Then $T\cup T'$ is a closed rectangle with $(a+1)(b+1)/2$. So the number of lattice points in $T$ is $$\frac{(a+1)(b+1)+C}2=\frac{ab}2+\frac{a+b+C}2+\frac12$$ where $C$ is the number of lattice points on the hypotenuse of $T$. We see that $a+b+C$ is one more than the number of lattice points on the perimeter of $T$. This gives Pick for $T$.