Rectangle $p*q,$ where $p,q$ are relatively coprime positive integers with $p <q$ is divided into squares $1*1$.Diagonal which goes from lowest left vertice to highest right cuts triangles from some squares.Find sum of perimeters of all such triangles.
Problem
Source: Tournament of Towns oral round p3
Tags: rectangle, combinatorics, combinatorial geometry, geometry, Tournament of Towns
22.03.2016 09:47
We call the side of a 1*1 square a segment. Observe that the sum of perimeters is the diagonal length + the sum of intercepts of the diagonal on the segments. Suppose the diagonal crosses a segment. Now the segment belongs to two of the unit squares and the diagonal forms two triangles to which this segment belongs. Observe that the sum of perimeters of the two triangles consists of the whole segment. This is true for all the segments crossed by the diagonal. It is also clear that the sum of intercepts of the diagonal on the segments is the sum of the lengths segments crossed by it. This sum is actually the no. of segments intercepted as each segment has length 1. WLOG there are (p-1) vertical and (q-1) horizontal lines that divide the rectangle into unit squares. The diagonal crosses each of these lines exactly once (as two non-parallel lines intersect at exactly one point) and each intersection determines one segment crossed by the diagonal. So no. of segments crossed = (p-1) + (q-1) = (p+q-2). However we have not counted two segments which form a part of the sum of perimeters, they are the two complete segments of the lower left and upper right squares which are a part of the triangle intercepted by the diagonal in these two squares. So total no. of segments = (p+q-2) + 2 = p+q. Hence required perimeter = length of diagonal +p+q = (p^2+q^2)^(1/2) + p + q
22.03.2016 12:40
Your solution is wrong of course.Try p=1,q=3 for instance .
15.11.2016 16:04
any idea
15.11.2016 18:59
It is easy to see that the answer is $\Big( \sqrt{\Big( \frac{p}{q}\Big)^2+1}+1+\frac{p}{q}\Big)k$ where $k$ is the number of integer $0\leq n\leq q-1$ such that $\Big\lceil \frac{pn}{q}\Big\rceil =\Big\lfloor \frac{p(n+1)}{q}\Big\rfloor$. It's clear that $n=0$ satisfy the equation. For $n\neq 0$ (which means $\frac{pn}{q}\not\in \mathbb{Z}$), the equation hold iff $\{ \frac{pn}{q} \} \in \Big[ 1-\frac{p}{q},1\Big)$. Since $\gcd(p,q)=1$, we have $\{ \{ \frac{pn}{q}\} \mid 1\leq n\leq q-1\}=\{ \frac{i}{q}\mid i=1,2,...,q-1\}$, so there exists exactly $p$ values of $n$ that $\{ \frac{pn}{q}\} \in\{ \frac{q-p}{q},\frac{q-p+1}{p},...,\frac{q-1}{q}\}$. Hence, the answer is $(p+1)\Big( \sqrt{\Big( \frac{p}{q}\Big)^2+1}+1+\frac{p}{q}\Big)$.