# FCS: Assignment 4. Math Salavat Dinmukhametov 1. 5 2. 13 3. 6 4. 00100110, 22 5. 01100111, 55 ## Task 1 a) 8, 15, 6 is not prime numbers, so first of all lets simplify them. a = 3<sup>7</sup>\* 2<sup>9</sup> \* 5<sup>6</sup> b = 2<sup>3</sup> \* 3<sup>5</sup> \* 7<sup>4</sup> \* 11 GCD(n, m) = p<sub>1</sub><sup>min(d<sub>1</sub>, e<sub>1</sub>)</sup> ... p<sub>k</sub><sup>min(d<sub>k</sub>, e<sub>k</sub>)</sup> LCM(n, m) = p<sub>1</sub><sup>max(d<sub>1</sub>, e<sub>1</sub>)</sup> ... p<sub>k</sub><sup>max(d<sub>k</sub>, e<sub>k</sub>)</sup> So , GCD(a, b) = 2<sup>3</sup> \* 3<sup>5</sup> = 1944 LCM(n, m) = 2<sup>9</sup> \* 3<sup>7</sup> \* 5<sup>6</sup> \* 7<sup>4</sup> \* 11 = 4,62086856×10¹⁴ b) 7<sup>1234</sup> mod 11 c ≡ (a \* b) mod m c ≡ (a \* (b (mod m))) mod m So, I wrote simple python program ![](https://i.imgur.com/QXjylwY.png) ## Task 2 gcd(26, 91) | Step | Pair | Reminder | Linear Comb | | -------- | -------- | -------- | ---| | 1 | 91 26 | 13 | 91 = 26\*3 + 13 | 2 | 26 13 | 0 | 26 = 13 \* 2 Answer = 13 ## Task 3 Next five states of the LFSR: 1) | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | | - | - | - | - | - | - | - | - | - | 2) | 1 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 3) | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 4) | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 1 | 5) | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 6) | 1 | 0 | 1 | 1 | 0 | 1 | 1 | 1 | Previous four states 1) | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 1 | | - | - | - | - | - | - | - | - | - | 2) | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 3) | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 4) | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 1 | 5) | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | if we xor 1111 with 1110, where 1110 is first 4 bits in 4 state, result is 0001. Then lets xor with 0111, is 4 state, 0110. See table below | step | plaintext | key | result | | -------- | -------- | -------- | - | | 1 | 1111 | 1110| 0001 | 2 | 0001 | 0111| 0110 | 3 | 0110 | 1011| 1101 | 4 | 1101 | 0101| 1000 Answer: 1000