MehrajShakil's blog

By MehrajShakil, history, 8 days ago, In English,

In this problem the number of integer points on a segment is gcd(x,y)+1. where x = abs(x1-x2) and y = abs(y1-y2). But why it does? Anyone please explain it. Thanks in advance.

 
 
 
 
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
8 days ago, # |
  Vote: I like it +1 Vote: I do not like it

you can find answer whit this formula. sqrt((x2-x1)^2+(Y2-Y1)^2)/(max(tg a, ctg a)) where a is angel betveen segment and x axis