10 likes | 136 Views
EE(3, 13). (-4, 1, 1). EE(13, 3). (1, -4, 1). EE(3, 1). (0, 1, 1). EE(1,0). (1, 0, 1). Compute: 3^-1 mod 13 Result: -4 * 3 + 1*13 = 1 Or: -4 * 3 = 1 (mod 13) Note: -4 = 9 (mod 13) So: 9 * 3 = 27 = 1 (mod 13). EE(a, b)
E N D
EE(3, 13) (-4, 1, 1) EE(13, 3) (1, -4, 1) EE(3, 1) (0, 1, 1) EE(1,0) (1, 0, 1) Compute: 3^-1 mod 13 Result: -4 * 3 + 1*13 = 1 Or: -4 * 3 = 1 (mod 13) Note: -4 = 9 (mod 13) So: 9 * 3 = 27 = 1 (mod 13) EE(a, b) if (b == 0) return (1, 0, a) (x’, y’, d) = EE(b, a mod b) return (y’, x’ – (a/b)y’, d)