Heron's method/Program/Natural register/Exercise
Write a computer-program (pseudocode) for the computation of rational approximations for the square root of a rational number using Heron's method.
- The computer has as many memory units as needed, which can contain natural numbers.
- It can compare the content of memory units and can, depending on the outcome, switch to a certain program line.
- It can add the content of two memory units and write the result into another memory unit.
- It can multiply the content of two memory units and write the result into another memory unit.
- It can print contents of memory units and it can print given texts.
- There is a stop command.
The initial configuration is
with . Here, is the number from which we want to compute the square root, is the initial value and is the wished-for accuracy. The program shall compute and print the Heron-sequence (the numerators and denominators are printed successively) and it shall stop when the member printed last fulfills the property