Metamath Proof Explorer


Theorem digit2

Description: Two ways to express the K th digit in the decimal (when base B = 1 0 ) expansion of a number A . K = 1 corresponds to the first digit after the decimal point. (Contributed by NM, 25-Dec-2008)

Ref Expression
Assertion digit2 A B K B K A mod B = B K A B B K 1 A

Proof

Step Hyp Ref Expression
1 nnre B B
2 nnnn0 K K 0
3 reexpcl B K 0 B K
4 1 2 3 syl2an B K B K
5 remulcl B K A B K A
6 4 5 stoic3 B K A B K A
7 6 3comr A B K B K A
8 reflcl B K A B K A
9 7 8 syl A B K B K A
10 nnrp B B +
11 10 3ad2ant2 A B K B +
12 modval B K A B + B K A mod B = B K A B B K A B
13 9 11 12 syl2anc A B K B K A mod B = B K A B B K A B
14 simp2 A B K B
15 fldiv B K A B B K A B = B K A B
16 7 14 15 syl2anc A B K B K A B = B K A B
17 nncn B B
18 expcl B K 0 B K
19 17 2 18 syl2an B K B K
20 19 3adant1 A B K B K
21 recn A A
22 21 3ad2ant1 A B K A
23 nnne0 B B 0
24 17 23 jca B B B 0
25 24 3ad2ant2 A B K B B 0
26 div23 B K A B B 0 B K A B = B K B A
27 20 22 25 26 syl3anc A B K B K A B = B K B A
28 nnz K K
29 expm1 B B 0 K B K 1 = B K B
30 17 23 28 29 syl2an3an B K B K 1 = B K B
31 30 3adant1 A B K B K 1 = B K B
32 31 oveq1d A B K B K 1 A = B K B A
33 27 32 eqtr4d A B K B K A B = B K 1 A
34 33 fveq2d A B K B K A B = B K 1 A
35 16 34 eqtrd A B K B K A B = B K 1 A
36 35 oveq2d A B K B B K A B = B B K 1 A
37 36 oveq2d A B K B K A B B K A B = B K A B B K 1 A
38 13 37 eqtrd A B K B K A mod B = B K A B B K 1 A