I was solving $\gcd$ algorithm problem.
The problem was to get a $\gcd$ from two special numbers.
Followings are conditions.
1) User can input number $a$ and $b$
(maximum ciphers of a,b is 19. so type is must be unsinged long long
2) Two special numbers made by repetition of "1" as much as a,b.
ex) $a=4$, $b=3$ -> special number : 1111, 111
3) Finally, have to get a $\gcd$ of those two special numbers.
But I found specific relation between them.
Let special numbers by $a$, $b$ call $s_a$, $s_b$. then we can preset $s_a$, $s_b$ like below: $$s_a=10^{a-1}+10^{a-2}+\dots+10^0\quad \text{and} \quad s_b=10^{b-1}+10^{b-2}+\dots+10^0.$$
From this, my foundation is below. $$\gcd(s_a,s_b) = 10^{\gcd(a,b)-1}+10^{\gcd(a,b)-2}+\dots+10^0$$ but I can't prove why it works. Can you prove about this?
Sorry for my poor English. I'm korean..