How to prove that two variables have the same first digit by modular arithmetic?

35 Views Asked by At

How could I find that x and y have the same first digit(Like, 52, 2 is the first digit here. Just an example) by using modulo arithmetic?

1

There are 1 best solutions below

8
On

If we write $x$ in decimal expansion: $$x=\overline{a_n....a_2a_1a_0}=10a+a_0$$ where $a =\overline{a_n....a_2a_1}$, and $$y=\overline{b_m....b_2b_1b_0} = 10b+b_0$$ then $x-y = 10(a-b)+(a_0-b_0)$, so if $a_0=b_0$ then $10\mid x-y$ which means:

$$ x\equiv y{\mod 10}$$