Metamath Proof Explorer


Theorem 3dvds

Description: A rule for divisibility by 3 of a number written in base 10. This is Metamath 100 proof #85. (Contributed by Mario Carneiro, 14-Jul-2014) (Revised by Mario Carneiro, 17-Jan-2015) (Revised by AV, 8-Sep-2021)

Ref Expression
Assertion 3dvds N 0 F : 0 N 3 k = 0 N F k 10 k 3 k = 0 N F k

Proof

Step Hyp Ref Expression
1 3z 3
2 1 a1i N 0 F : 0 N 3
3 fzfid N 0 F : 0 N 0 N Fin
4 ffvelrn F : 0 N k 0 N F k
5 4 adantll N 0 F : 0 N k 0 N F k
6 10nn 10
7 6 nnzi 10
8 elfznn0 k 0 N k 0
9 8 adantl N 0 F : 0 N k 0 N k 0
10 zexpcl 10 k 0 10 k
11 7 9 10 sylancr N 0 F : 0 N k 0 N 10 k
12 5 11 zmulcld N 0 F : 0 N k 0 N F k 10 k
13 3 12 fsumzcl N 0 F : 0 N k = 0 N F k 10 k
14 3 5 fsumzcl N 0 F : 0 N k = 0 N F k
15 12 5 zsubcld N 0 F : 0 N k 0 N F k 10 k F k
16 ax-1cn 1
17 6 nncni 10
18 16 17 negsubdi2i 1 10 = 10 1
19 9p1e10 9 + 1 = 10
20 19 eqcomi 10 = 9 + 1
21 20 oveq1i 10 1 = 9 + 1 - 1
22 9cn 9
23 22 16 pncan3oi 9 + 1 - 1 = 9
24 18 21 23 3eqtri 1 10 = 9
25 3t3e9 3 3 = 9
26 24 25 eqtr4i 1 10 = 3 3
27 17 a1i k 0 10
28 1re 1
29 1lt10 1 < 10
30 28 29 gtneii 10 1
31 30 a1i k 0 10 1
32 id k 0 k 0
33 27 31 32 geoser k 0 j = 0 k 1 10 j = 1 10 k 1 10
34 fzfid k 0 0 k 1 Fin
35 elfznn0 j 0 k 1 j 0
36 35 adantl k 0 j 0 k 1 j 0
37 zexpcl 10 j 0 10 j
38 7 36 37 sylancr k 0 j 0 k 1 10 j
39 34 38 fsumzcl k 0 j = 0 k 1 10 j
40 33 39 eqeltrrd k 0 1 10 k 1 10
41 1z 1
42 zsubcl 1 10 1 10
43 41 7 42 mp2an 1 10
44 28 29 ltneii 1 10
45 16 17 subeq0i 1 10 = 0 1 = 10
46 45 necon3bii 1 10 0 1 10
47 44 46 mpbir 1 10 0
48 7 32 10 sylancr k 0 10 k
49 zsubcl 1 10 k 1 10 k
50 41 48 49 sylancr k 0 1 10 k
51 dvdsval2 1 10 1 10 0 1 10 k 1 10 1 10 k 1 10 k 1 10
52 43 47 50 51 mp3an12i k 0 1 10 1 10 k 1 10 k 1 10
53 40 52 mpbird k 0 1 10 1 10 k
54 48 zcnd k 0 10 k
55 negsubdi2 10 k 1 10 k 1 = 1 10 k
56 54 16 55 sylancl k 0 10 k 1 = 1 10 k
57 53 56 breqtrrd k 0 1 10 10 k 1
58 peano2zm 10 k 10 k 1
59 48 58 syl k 0 10 k 1
60 dvdsnegb 1 10 10 k 1 1 10 10 k 1 1 10 10 k 1
61 43 59 60 sylancr k 0 1 10 10 k 1 1 10 10 k 1
62 57 61 mpbird k 0 1 10 10 k 1
63 negdvdsb 1 10 10 k 1 1 10 10 k 1 1 10 10 k 1
64 43 59 63 sylancr k 0 1 10 10 k 1 1 10 10 k 1
65 62 64 mpbid k 0 1 10 10 k 1
66 26 65 eqbrtrrid k 0 3 3 10 k 1
67 muldvds1 3 3 10 k 1 3 3 10 k 1 3 10 k 1
68 1 1 59 67 mp3an12i k 0 3 3 10 k 1 3 10 k 1
69 66 68 mpd k 0 3 10 k 1
70 9 69 syl N 0 F : 0 N k 0 N 3 10 k 1
71 11 58 syl N 0 F : 0 N k 0 N 10 k 1
72 dvdsmultr2 3 F k 10 k 1 3 10 k 1 3 F k 10 k 1
73 1 5 71 72 mp3an2i N 0 F : 0 N k 0 N 3 10 k 1 3 F k 10 k 1
74 70 73 mpd N 0 F : 0 N k 0 N 3 F k 10 k 1
75 5 zcnd N 0 F : 0 N k 0 N F k
76 11 zcnd N 0 F : 0 N k 0 N 10 k
77 75 76 muls1d N 0 F : 0 N k 0 N F k 10 k 1 = F k 10 k F k
78 74 77 breqtrd N 0 F : 0 N k 0 N 3 F k 10 k F k
79 3 2 15 78 fsumdvds N 0 F : 0 N 3 k = 0 N F k 10 k F k
80 12 zcnd N 0 F : 0 N k 0 N F k 10 k
81 3 80 75 fsumsub N 0 F : 0 N k = 0 N F k 10 k F k = k = 0 N F k 10 k k = 0 N F k
82 79 81 breqtrd N 0 F : 0 N 3 k = 0 N F k 10 k k = 0 N F k
83 dvdssub2 3 k = 0 N F k 10 k k = 0 N F k 3 k = 0 N F k 10 k k = 0 N F k 3 k = 0 N F k 10 k 3 k = 0 N F k
84 2 13 14 82 83 syl31anc N 0 F : 0 N 3 k = 0 N F k 10 k 3 k = 0 N F k