I have the following problem to solve in Mathematica, but (maybe because of my inexperience) it seems quite a really one to code properly.
Given a line $y=mx+q$ with $q>0$ and $m<0$, this intersects the positive $x$-axis and a positive $y$-axis to form a rectangular triangle in the first quadrant.
I would like to find an algorithm that will allow me to write all the integral points $(x,y)$ contained inside of such triangle (or on in boundary) in function of $m$ and $q$. With integral points I mean points such that $x$ and $y$ are integer numbers. Furthermore (an this is crucial) I would like to have the set of coordinates of such output points as entries of a list.
So far I can solve the problem via a nested "while cycle" but the output is not a list, rather it is many cells, each one printing the coordinates of one point inside.