2 Consider the following algorithm.
STEP 1 Input a number \(N\)
STEP 2 Calculate \(R = N \div 2\)
STEP 3 Calculate \(S = ( ( N \div R ) + R ) \div 2\)
STEP 4 If \(R\) and \(S\) are the same when rounded to 2 decimal places, go to STEP 7
STEP 5 Replace \(R\) with the value of \(S\)
STEP 6 Go to STEP 3
STEP 7 Output the value of \(R\) correct to 2 decimal places
- Work through the algorithm starting with \(N = 16\). Record the values of \(R\) and \(S\) each time they change and show the value of the output.
- Work through the algorithm starting with \(N = 2\). Record the values of \(R\) and \(S\) each time they change and show the value of the output.
- What does the algorithm achieve for positive inputs?
- Show that the algorithm fails when it is applied to \(N = - 4\).
- Describe what happens when the algorithm is applied to \(N = - 2\). Suggest how the algorithm could be improved to avoid this problem, without imposing a restriction on the allowable input values.