commit a573111c587fa6e98050a005b3cdf663feff4bef
parent 66a55378d0c149f96147a3b7e70c88d6d4b2c5b9
Author: Agastya Chandrakant <acagastya@outlook.com>
Date: Mon, 16 Apr 2018 21:56:37 +0530
add
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/s4/fafl/report.md b/s4/fafl/report.md
@@ -50,14 +50,16 @@ __Refer figure 2 for TM1 which acts as a transducer to find remainder and quotie
Since calculation of modulo is subtracion of `v` from `u` until `u` is strictly smaller than `v`, procedure to follow `u - v` is as follows: (__Assumption: Instruction pointer points to index 1__)
1. While current cell value is not `0`, move right.
-2. If current cell value is `0`, go left. If it is `1`:
- - Go right. Go right. If it is `1`:
+2. If current cell value is `0`, go left. If it is `1`: Go right. Go right.
+ - If it is `1`:
- Go right until current cell is `B`.
- Move left until current cell is `1`.
- Mark it as `X`.
- Move left until current cell is `B`.
- Move right, make `1` as `B`. Goto step #1.
-
+ - If it is `X`, one subtraction is finished. (It's progress can be tracked, which will be mentioned later while dealing with quotient)
+ - Go right making all `X` as `1` until current cell is `B`.
+ - if current cell is `B` go left until current cell is `0`. Goto step #2.
#### To find if the number is prime
For an input `num`, the first step is to make a copy of $\lfloor\dfrac{num}{2}\rfloor$ start reading the tape from the beginning. (__Assumption: Instruction pointer points to index 0__)