A flexadecimal number consists of a sequence of digits, with the rule that the rightmost digit must be 0 or 1 , the digit to the left of it is 0,1 , or 2 , the third digit (counting from the right) must be at most 3 , and so on. As usual, we may omit leading digits if they are zero. We write flexadecimal numbers in angle brackets to distinguish them from ordinary, decimal numbers. Thus $\langle 34101 \rangle$ is a flexadecimal number, but $\langle 231 \rangle$ is not, because the digit 3 is too big for its place. (If flexadecimal numbers get very long, we will need 'digits' with a value more than 9 .) The number 1 is represented by $\langle 1 \rangle$ in flexadecimal. To add 1 to a flexadecimal number, work from right to left. If the rightmost digit $d _ { 1 }$ is 0 , replace it by 1 and finish. Otherwise, replace $d _ { 1 }$ by 0 and examine the digit $d _ { 2 }$ to its left, appending a zero at the left if needed at any stage. If $d _ { 2 } < 2$, then increase it by 1 and finish, but if $d _ { 2 } = 2$, then replace it by 0 , and again move to the left. The process stops when it reaches a digit that can be increased without becoming too large. Thus, the numbers 1 to 4 are represented as $\langle 1 \rangle , \langle 10 \rangle , \langle 11 \rangle , \langle 20 \rangle$. (i) Write the numbers from 5 to 13 in flexadecimal. (ii) Describe a workable procedure for converting flexadecimal numbers to decimal, and explain why it works. Demonstrate your procedure by converting $\langle 1221 \rangle$ to decimal. (iii) Describe a workable procedure for converting decimal numbers to flexadecimal, and demonstrate it by converting 255 to flexadecimal. (iv) We could add flexadecimal numbers by converting them to decimal, adding the decimal numbers and converting the result back again. Describe instead a procedure for addition that works directly on the digits of two flexadecimal numbers, and demonstrate it by performing the addition $\langle 1221 \rangle + \langle 201 \rangle$. (v) Given a flexadecimal number, how could you test whether it is a multiple of 3 without converting it to decimal? (vi) If the $\langle 100000 \rangle$ arrangements of the letters abcdef are listed in alphabetical order and numbered $\langle 0 \rangle$ : abcdef, $\langle 1 \rangle$ : abcdfe, $\langle 10 \rangle$ : abcedf, etc., what arrangement appears in position $\langle 34101 \rangle$ in the list? If you require additional space please use the pages at the end of the booklet
& 1 & 25 & $15 *$ & 0
\section*{6. For APPLICANTS IN $\left\{ \begin{array} { l } \text { COMPUTER SCIENCE } \\ \text { MATHEMATICS \& COMPUTER SCIENCE } \\ \text { COMPUTER SCIENCE \& PHILOSOPHY } \end{array} \right\}$ ONLY.}
A flexadecimal number consists of a sequence of digits, with the rule that the rightmost digit must be 0 or 1 , the digit to the left of it is 0,1 , or 2 , the third digit (counting from the right) must be at most 3 , and so on. As usual, we may omit leading digits if they are zero. We write flexadecimal numbers in angle brackets to distinguish them from ordinary, decimal numbers. Thus $\langle 34101 \rangle$ is a flexadecimal number, but $\langle 231 \rangle$ is not, because the digit 3 is too big for its place. (If flexadecimal numbers get very long, we will need 'digits' with a value more than 9 .)
The number 1 is represented by $\langle 1 \rangle$ in flexadecimal. To add 1 to a flexadecimal number, work from right to left. If the rightmost digit $d _ { 1 }$ is 0 , replace it by 1 and finish. Otherwise, replace $d _ { 1 }$ by 0 and examine the digit $d _ { 2 }$ to its left, appending a zero at the left if needed at any stage. If $d _ { 2 } < 2$, then increase it by 1 and finish, but if $d _ { 2 } = 2$, then replace it by 0 , and again move to the left. The process stops when it reaches a digit that can be increased without becoming too large. Thus, the numbers 1 to 4 are represented as $\langle 1 \rangle , \langle 10 \rangle , \langle 11 \rangle , \langle 20 \rangle$.\\
(i) Write the numbers from 5 to 13 in flexadecimal.\\
(ii) Describe a workable procedure for converting flexadecimal numbers to decimal, and explain why it works. Demonstrate your procedure by converting $\langle 1221 \rangle$ to decimal.\\
(iii) Describe a workable procedure for converting decimal numbers to flexadecimal, and demonstrate it by converting 255 to flexadecimal.\\
(iv) We could add flexadecimal numbers by converting them to decimal, adding the decimal numbers and converting the result back again. Describe instead a procedure for addition that works directly on the digits of two flexadecimal numbers, and demonstrate it by performing the addition $\langle 1221 \rangle + \langle 201 \rangle$.\\
(v) Given a flexadecimal number, how could you test whether it is a multiple of 3 without converting it to decimal?\\
(vi) If the $\langle 100000 \rangle$ arrangements of the letters abcdef are listed in alphabetical order and numbered $\langle 0 \rangle$ : abcdef, $\langle 1 \rangle$ : abcdfe, $\langle 10 \rangle$ : abcedf, etc., what arrangement appears in position $\langle 34101 \rangle$ in the list?
If you require additional space please use the pages at the end of the booklet