Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab Help Problem W1.4 (Bzout's identity and certifying Euclidean algorithm). An algorithm is called certifying when it can check whether the output is correct or
Matlab Help
Problem W1.4 (Bzout's identity and certifying Euclidean algorithm). An algorithm is called certifying when it can check whether the output is correct or not. For ex- ample, the highest common factor h of two integers n and m, not simultaneously 0, is characterised by being a divisor of both and writable in the form h=sm+tn for some stez. (W1.4.1) The latter is called Bzout's identity. The extended Euclidean algorithm provides a construction of such coefficients set as follows Require: m,n two integers with n=0 Ensure: r,s,t integers such that r=hcf{m, n} and sm+tn=r (Bzout) 1: procedure EXTENDED-EUCLID(m,n) r-1 m, ron , k- 1 while re #0 do answer is reached when rk = 0 (9k, rk) - div{rk-2, Pk-1) (sk, tk) - (Sk-1, tk-1)-9(Sk-2, tk-2) krk+1 7: end while 8: return Ik-1 phcf is the last non-zero remainder 9: end procedure Write a code that inputs two integers m, n, not simultaneously zero, and outputs three integers r, s, t such that r=hcf{m, n} and h=sm+tn. [40 marks] i Problem W1.4 (Bzout's identity and certifying Euclidean algorithm). An algorithm is called certifying when it can check whether the output is correct or not. For ex- ample, the highest common factor h of two integers n and m, not simultaneously 0, is characterised by being a divisor of both and writable in the form h=sm+tn for some stez. (W1.4.1) The latter is called Bzout's identity. The extended Euclidean algorithm provides a construction of such coefficients set as follows Require: m,n two integers with n=0 Ensure: r,s,t integers such that r=hcf{m, n} and sm+tn=r (Bzout) 1: procedure EXTENDED-EUCLID(m,n) r-1 m, ron , k- 1 while re #0 do answer is reached when rk = 0 (9k, rk) - div{rk-2, Pk-1) (sk, tk) - (Sk-1, tk-1)-9(Sk-2, tk-2) krk+1 7: end while 8: return Ik-1 phcf is the last non-zero remainder 9: end procedure Write a code that inputs two integers m, n, not simultaneously zero, and outputs three integers r, s, t such that r=hcf{m, n} and h=sm+tn. [40 marks]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started