```python
%matplotlib inline
from IPython.display import display,Math
from sympy import *
init_session()
```


```python
%%time
# 最大公約数 gcd(a, b) を求めるアルゴリズム その1
a, b = 20210608, 80601202
i = 1
while i <= b:
    if a%i == 0:
        if b%i == 0:
            M  = i
    i = i+1
print(M)
```


```python
%%time
# 最大公約数 gcd(a, b) を求めるアルゴリズム その2
a, b = 20210608, 80601202
r = a%b
while r != 0:
    a,b = b,r
    r = a%b
print(b)
```


```python
from ipywidgets import interact
import time
def mygcd2(a,b):
    r = a%b
    count = 1
    while r != 0:
        count += 1
        a,b = b,r
        r = a%b
    return b,count
@interact
def _(a="314159265",b="35"):
    digits = len(b)
    a,b = int(a),int(b)
    d,count = mygcd2(a,b)
    return display(Math("gcd({0:d},{1:d})={2:d}, (digits,count)=({3:d},{4:d})".format(a,b,d,digits,count)))
```


```python

```


```python

```

fa419b6f1d8fd27d9c3c5424859f38a7211b55de
ipynb
Jupyter Notebook
21jk1-0609.ipynb
ritsumei-aoi/21jk1
2d49628ef8721a507193a58aa1af4b31a60dfd8b
Apache-2.0
21jk1-0609.ipynb
ritsumei-aoi/21jk1
2d49628ef8721a507193a58aa1af4b31a60dfd8b
Apache-2.0
21jk1-0609.ipynb
ritsumei-aoi/21jk1
2d49628ef8721a507193a58aa1af4b31a60dfd8b
Apache-2.0
Qwen/Qwen-72B
1. YES
2. YES