# nie-ii-year

lab stuff from undergrad second year.
git clone http://git.hanabi.in/repos/nie-ii-year.git
Log | Files | Refs | LICENSE

```commit a474c25255da412efda5316324b06d06878e4384
parent 6db63da9012406dfbe231b0499db834ffa1f3d5d
Author: Agastya Chandrakant <acagastya@outlook.com>
Date:   Mon, 16 Apr 2018 21:47:39 +0530

Diffstat:
Ms4/fafl/report.md | 13+++++++++++--
```
```1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/s4/fafl/report.md b/s4/fafl/report.md
@@ -47,11 +47,20 @@ __Refer figure 2 for TM1 which acts as a transducer to find remainder and quotie

#### For calculation of remainder and quotient

-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__)
+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`:
+ a. Go right. Go right. If it is `1`:
+  i. Go right until current cell is `B`.
+  ii. Move left until current cell is `1`.
+  iii. Mark it as `X`.
+  iv. Move left until current cell is `B`.
+  v. MOve right, make `1` as `B`. Goto step #1.

#### 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__)
+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__)

1. For every second `1` encountered, mark it as `D`.
2. Move right until `B` is found.
```