how many distinct values does it have? I solved this problem by manually adding parentheses and counting them, and got correct answer of 32. Is there a simple to find the answer? Thanks.

The value of the expression $1÷2÷3÷5÷7÷11÷13$ can be altered by including parentheses. If we are allowed to place as many parentheses as we want, how many distinct values can be obtained for this expression?


In general, inserting parentheses in
 $$ a_1 \div a_2 \div a_3 \div \cdots \div a_n $$
can produce every number of the form
$$ a_1^{\strut}a_2^{-1}a_3^{s_3} a_4^{s_4} \cdots a_n^{s_n}$$
(and only those), where each $s_i$ is either $1$ or $-1$. Note that the exponents of $a_1$ and $a_2$ are fixed.
If $a_3$ through $a_n$ are coprime (as is the case here), this gives $2^{n-2}$ different possible values.
Proof by induction on $n$. The base case is $n=2$ where there is only a single possibility.
For $n>2$, first parenthesize $a_1\div\cdots\div a_{n-1}$ in order to get the desired exponents for $a_1$ through $a_{n-1}$.
Then, if the desired $s_n$ is opposite to $s_{n-1}$ then just replace $a_{n-1}$ by $(a_{n-1}\div a_n)$.
Otherwise the desired exponents $s_n$ and $s_{n-1}$ are equal. Let $E$ be the fully parenthesized expression such that $(E\div a_{n-1})$ is a subexpression of what we got from the induction hypothesis (that is, $E$ is the left operand to the division whose immediate right operand is $a_{n-1}$, and such a division always exists because $n-1\ge 2$), and replace this entire subexpression with $((E \div a_{n-1})\div a_n)$.
