Given is chocolate with rectangular pieces of size $a \times b$. If cut diagonally, how many pieces will it be split into? If knife passes exactly by co-catenating we assume there is no damage to pieces.
I've been asked about it. It's of course easy question (my proof below), but now I began to wonder about interesting solutions to this problem. Feel free to share any idea!
Most obvious solution. Firstly reduce problem to easy subproblem. Note that if $gcd(a,b) = d > 1$, knife intersect concatenating $d-1$ times. And we have d regular problems. Same rectangle $a' \times b'$, such that $a'd=a \wedge b'd= b$.
Now we have to consider $a' \times b'$. It's clear that knife can't pass through a corrner ($gcd(a',b')=1$), knife has to pass by two edges of any chocolate bar, excluding first and last. There is only once. We should notice, two neighboring pieces share one edge. So in this rectangle we sectioned $a'+b'-1$ bars.
$$\frac{1 +2(a'-1) + 2(b'-1) + 1}{2} = \frac{2a' + 2b' - 2}{2} = a'+b'-1 $$
So the ended solution is $a+b - gcd(a,b)$.
$$d\cdot(a'+b'-1) = a + b - d = a+b - gcd(a,b)$$