This is a historical and challenging problem

• Oct 3rd 2012, 08:49 PM
testtrail429
This is a historical and challenging problem
• Oct 7th 2012, 09:39 AM
Chokfull
Re: This is a historical and challenging problem
$\sum_{i=1}^n [floor(\frac{i*m}{n})-floor(\frac{(i-1)*m}{n})+1$]

Floor(x) means the greatest integer less than or equal to x.

Would this formula work, or are you looking for something simpler? Because this is all I could come up with.

You can see how I got this if you look at how many squares you intersect when you go to the left 1 unit. If we let X equal the slope, then $floor(x)+1$ is the number of squares intersected across the first column. The same basic rule would apply for subsequent columns, but you must subtract the amount intersected in the previous columns.