L05_exgcd

# L05_exgcd - 1-1Recall that(**)y[i-1] =x[i]and(*)x[i-1]

This preview shows pages 1–6. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1-1Recall that(**)y[i-1] =x[i]and(*)x[i-1] =y[i]-q[i-1]x[i]Example:k= 184, j= 69and we wantj[i]x[i] +k[i]y[i] =gcd(k[i], j[i])1-2ik[i]=j[i]q[i]+r[i]k[i]j[i]r[i]q[i]y[i]x[i]184=69(2)+4618469462-13169=46(1)+2369462311-1246=23(2)+462321Recall that(**)y[i-1] =x[i]and(*)x[i-1] =y[i]-q[i-1]x[i]Example:k= 184, j= 691) First run the regular GCD algorithm: getgcd(184,69) = 23and we wantj[i]x[i] +k[i]y[i] =gcd(k[i], j[i])1-3ik[i]=j[i]q[i]+r[i]k[i]j[i]r[i]q[i]y[i]x[i]184=69(2)+4618469462-13169=46(1)+2369462311-1246=23(2)+462321Recall that(**)y[i-1] =x[i]and(*)x[i-1] =y[i]-q[i-1]x[i]Example:k= 184, j= 691) First run the regular GCD algorithm: getgcd(184,69) = 232) Then calculatey[2] = 0, x[2] = 1and we wantj[i]x[i] +k[i]y[i] =gcd(k[i], j[i])1-4ik[i]=j[i]q[i]+r[i]k[i]j[i]r[i]q[i]y[i]x[i]184=69(2)+4618469462-13169=46(1)+2369462311-1246=23(2)+462321Recall that(**)y[i-1] =x[i]and(*)x[i-1] =y[i]-q[i-1]x[i]Example:k= 184, j= 691) First run the regular GCD algorithm: getgcd(184,69) = 232) Then calculatey[2] = 0, x[2] = 13) Continue bottom-up, calculating thex[i], y[i]from(*)and(**)and we wantj[i]x[i] +k[i]y[i] =gcd(k[i], j[i])1-5ik[i]=j[i]q[i]+r[i]k[i]j[i]r[i]q[i]y[i]x[i]184=69(2)+4618469462-13169=46(1)+2369462311-1246=23(2)+462321Recall that(**)y[i-1] =x[i]and(*)x[i-1] =y[i]-q[i-1]x[i]Example:k= 184, j= 691) First run the regular GCD algorithm: getgcd(184,69) = 232) Then calculatey[2] = 0, x[2] = 13) Continue bottom-up, calculating thex[i], y[i]from(*)and(**)and we want...
View Full Document

## This note was uploaded on 08/25/2010 for the course COMP COMP170 taught by Professor M.j.golin during the Spring '10 term at HKUST.

### Page1 / 14

L05_exgcd - 1-1Recall that(**)y[i-1] =x[i]and(*)x[i-1]

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online