Qm

Grid points on a straight line segment

On squared paper, a straight segment is drawn from the point (0, 0) to the point (12, 18), where the coordinates are whole numbers.

How many points with whole-number coordinates lie on the segment, counting both endpoints? Find the general rule for a segment from (0, 0) to (a, b).

Show a hint

Points on the segment have the form (12t, 18t) for t between 0 and 1. When are both coordinates whole numbers?

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

How many squares does a diagonal cross?How many squares in a four-by-four grid of dots?The 100 lockers problemThe angle between two face diagonals of a cubeThe angles of a twenty-sided polygon
All questions →