User:Jmleonrojas/sandbox

Paper generation

 * Paper generator
 * http://www.plainenglish.co.uk/gobbledygook-generator.html

Euclid's algorithm example
(where $a,b\in \mathbb{Z}^+$ and $a>b$ ):

$a$ is divided by $b$, $a=bq_0+r_0$ , where $0\leqslant r_0 < b$ , then,

if $r_0=0$, $\operatorname{gcd}(a,b)=b$ , END;

if $r_0\neq 0$, $\operatorname{gcd}(a,b) = \operatorname{gcd}(b,r_0)$ ,

$b$ is divided by $r_0$, $a=bq_1+r_1$ , where $0\leqslant r_1 < r_0$ , then,

if $r_1=0$, $\operatorname{gcd}(b,r_0)=r_0$ , END;

if $r_1\neq 0$, $\operatorname{gcd}(b,r_0) =\operatorname{gcd}(r_0,r_1)$ ,

$r_0$ is divided by $r_1$, $\ldots$

so we get a strictly decreasing sequence of remainders $r_0>r_1>r_2>\ldots>r_{k-1}>r_k>r_{k+1}=0$, and thus $\operatorname{gcd}(a,b) = \operatorname{gcd}(b,r_0) = \operatorname{gcd}(r_0,r_1) = \operatorname{gcd}(r_1,r_2) = \cdots = \operatorname{gcd}(r_{k-2},r_{k-1}) = \operatorname{gcd}(r_{k-1},r_{k}) = r_{k}$ , END;

implementation (given $a,b\in \mathbb{Z}^+$ and $a>b$, it calculates the $\operatorname{gcd}(a,b)$ ): $$\begin{aligned} r_0 & =a \\ r_1 & =b \\ & \,\,\,\vdots \\ r_{i+1} & =r_{i-1}-q_i r_i \quad \quad 0\le r_{i+1} < r_i \\ & \,\,\, \vdots \end{aligned}$$ it stops when a null remainder $r_{k+1}=0$ is reached, and then $\operatorname{gcd}(a,b)=r_k$  (the last non zero remainder);

gcd(4947,1455) = 291

+--+--+++ +--+--+++ +--+--+++ +--+--+++
 * | q₀ = 3  | q₁ = 2 | q₂ = 2 |
 * a = 4947 | b = 1455 | 582   | 291    |
 * r₀ = 582 | r₁ = 291 | r₂ = 0 |       |

r₀ > r₁ > r₁₊₁ = 0 then: gcd(4947,1455) = gcd(4947,582) = gcd(582,291) = 291

Extended Euclidean algorithm example
implementation (given $a,b\in \mathbb{Z}^+$ and $a>b$, it calculates the $\operatorname{gcd}(a,b)$  and two minimal Bézout coefficients $s$  and $t$ ): $$\begin{aligned} r_0 & =a & r_1 & =b \\ s_0 & =1 & s_1 & =0 \\ t_0 & =0 & t_1 & =1 \\ & \,\,\,\vdots & & \,\,\,\vdots \\ r_{i+1} & =r_{i-1}-q_i r_i & 0 & \le r_{i+1} < r_i & \\ s_{i+1} & =s_{i-1}-q_i s_i \\ t_{i+1} & =t_{i-1}-q_i t_i \\ & \,\,\, \vdots\end{aligned}$$ it stops when a null remainder $r_{k+1}=0$ is reached, and then $\operatorname{gcd}(a,b)=r_k$  (the last non zero remainder), $s=s_k$  and $t=t_k$, that is, $\operatorname{gcd}(a,b) = r_k = as_k + bt_k$ ;

History
 Tree list


 * 1 $$p \rightarrow q$$
 * 2 $$r \rightarrow \neg q$$
 * culture
 * art
 * craft
 * science

See

 * Articles for creation
 * Requested articles
 * Articles for deletion
 * Good articles
 * Featured articles
 * Vital articles
 * Today's articles for improvement
 * Community portal
 * Blocked users