OCR D1 2008 January — Question 7

Exam BoardOCR
ModuleD1 (Decision Mathematics 1)
Year2008
SessionJanuary
TopicFixed Point Iteration

7 In this question, the function INT( \(X\) ) is the largest integer less than or equal to \(X\). For example, $$\begin{aligned} & \operatorname { INT } ( 3.6 ) = 3 ,
& \operatorname { INT } ( 3 ) = 3 ,
& \operatorname { INT } ( - 3.6 ) = - 4 . \end{aligned}$$ Consider the following algorithm.
Step 1Input \(B\)
Step 2Input \(N\)
Step 3Calculate \(F = N \div B\)
Step 4Let \(G = \operatorname { INT } ( F )\)
Step 5Calculate \(H = B \times G\)
Step 6Calculate \(C = N - H\)
Step 7Output C
Step 8Replace \(N\) by the value of \(G\)
Step 9If \(N = 0\) then stop, otherwise go back to Step 3
  1. Apply the algorithm with the inputs \(B = 2\) and \(N = 5\). Record the values of \(F , G , H , C\) and \(N\) each time Step 9 is reached.
  2. Explain what happens when the algorithm is applied with the inputs \(B = 2\) and \(N = - 5\).
  3. Apply the algorithm with the inputs \(B = 10\) and \(N = 37\). Record the values of \(F , G , H , C\) and \(N\) each time Step 9 is reached. What are the output values when \(B = 10\) and \(N\) is any positive integer?