Problem

Source: Germany 2019, Problem 5

Tags: ratio, number theory, combinatorics



We are given two positive integers $p$ and $q$. Step by step, a rope of length $1$ is cut into smaller pieces as follows: In each step all the currently longest pieces are cut into two pieces with the ratio $p:q$ at the same time. After an unknown number of such operations, the currently longest pieces have the length $x$. Determine in terms of $x$ the number $a(x)$ of different lengths of pieces of rope existing at that time.