Question 101
Consider two coprime positive integers $p, q$, and for $i = 1, 2, \dots, q-1$ define $f(i)$ to be the remainder of $p \cdot i$ upon division by $q$. If $f(i)$ is the largest among $f(1), f(2), \dots, f(i)$, then $i$ is called a big number; if $f(i)$ is the smallest among $f(1), f(2), \dots, f(i)$, then $i$ is called a small number. Note that $1$ is both a big number and a small number.
Two positive integers $a, b$ are given. Suppose that among $1, 2, \dots, q-1$ there are $a$ big numbers and $b$ small numbers. Find the smallest possible value of $q$.
Two positive integers $a, b$ are given. Suppose that among $1, 2, \dots, q-1$ there are $a$ big numbers and $b$ small numbers. Find the smallest possible value of $q$.