𝑢, 𝑣, 𝑞, 𝑟, 𝑠, 𝑡, 𝑠1, 𝑡1, 𝑠2, 𝑡2
𝑢:= 𝑎
𝑣:= 𝑏
𝑠1:= 1
𝑡1:= 0
𝑠2:= 0
𝑡2:= 1
𝑟:= 𝑢 𝑣
(𝑟 > 0)
𝑞:= (𝑢−𝑟)/𝑣
𝑢:= 𝑣
𝑣:= 𝑟
𝑠:= 𝑠1𝑡:= 𝑡1𝑠1:= 𝑠2𝑡1:= 𝑡2
𝑠2:= 𝑠−𝑠1𝑞
𝑡2:= 𝑡−𝑡1𝑞
𝑟:= 𝑢 𝑣
(𝑣, 𝑠2, 𝑡2)
𝑛
𝑎 𝑏 𝑛
𝑎 𝑠−1= 1 𝑡−1= 0 (−1)
𝑏 𝑠0= 0 𝑡0= 1 (0)
𝑎=𝑏𝑞1+𝑟10< 𝑟1< 𝑏 𝑠1=𝑠−1−𝑞1𝑠0𝑡1=𝑡−1−𝑞1𝑡0(1)
𝑏=𝑟1𝑞2+𝑟20< 𝑟2< 𝑟1𝑠2=𝑠0−𝑞2𝑠1𝑡2=𝑡0−𝑞2𝑡1(2)
𝑟𝑖−2=𝑟𝑖−1𝑞𝑖+𝑟𝑖0< 𝑟𝑖< 𝑟𝑖−1𝑠𝑖=𝑠𝑖−2−𝑞𝑖𝑠𝑖−1𝑡𝑖=𝑡𝑖−2−𝑞𝑖𝑡𝑖−1(𝑖)
𝑟𝑛−3=𝑟𝑛−2𝑞𝑛−1+𝑟𝑛−10< 𝑟𝑛−1< 𝑟𝑛−2𝑠𝑛−1=⋅⋅⋅ 𝑡𝑛−1=⋅⋅⋅ (𝑛−1)
𝑟𝑛−2=𝑟𝑛−1𝑞𝑛(𝑛)
𝑠𝑖𝑎+𝑡𝑖𝑏=𝑟𝑖𝑠𝑖𝑡𝑖−1−𝑠𝑖−1𝑡𝑖= (−1)𝑖−1𝑝𝑔𝑐𝑑(𝑠𝑖, 𝑡𝑖)=1
∀𝑖
𝑠𝑖𝑠𝑖+1 (∣𝑠𝑖∣)𝑖
𝑡𝑖𝑡𝑖+1 (∣𝑡𝑖∣)𝑖
𝑟𝑖−1∣𝑠𝑖∣⩽𝑏 𝑟𝑖−1∣𝑡𝑖∣⩽𝑎
∣𝑠𝑛−1∣⩽𝑏/2∣𝑡𝑛−1∣⩽𝑎/2
𝑠𝑖𝑡𝑖
𝑞𝑖𝑟𝑖
𝑂
𝑂(𝑚𝑎𝑥(𝑙(𝑎), 𝑙(𝑏))2)