Consider a chessboard of size $8$ units $×$ $8$ units (i.e. each small square on the board has a side length of $1$ unit). Let $S$ be the set of all the $81$ vertices of all the squares on the board. What is the number of line segments whose vertices are in $S$, and whose length is a positive integer? (The segments need not be parallel to the sides of the board.)
This problem is from RMO 2017 Maharashtra and Goa Region.
I think I have successfully calculated the number of lines parallel to either of the sides of the chess board.
I found it to be $$1×9×2+2×9×2+3×9×2+...+8×9×2$$ (Am I right?)
Now, I am ready to count the number of non parallel lines. I find that there are only two pythagorean triplets-$(3,4)$ and $(8,6)$ up to $8$. What next? How to proceed? (Please tell me if I am wrong anywhere)