Metamath Proof Explorer


Theorem fmtnoprmfac1lem

Description: Lemma for fmtnoprmfac1 : The order of 2 modulo a prime that divides the n-th Fermat number is 2^(n+1). (Contributed by AV, 25-Jul-2021) (Proof shortened by AV, 18-Mar-2022)

Ref Expression
Assertion fmtnoprmfac1lem N P 2 P FermatNo N od P 2 = 2 N + 1

Proof

Step Hyp Ref Expression
1 eldifi P 2 P
2 prmnn P P
3 1 2 syl P 2 P
4 3 ad2antlr N P 2 P FermatNo N P
5 nnnn0 N N 0
6 fmtno N 0 FermatNo N = 2 2 N + 1
7 5 6 syl N FermatNo N = 2 2 N + 1
8 7 breq2d N P FermatNo N P 2 2 N + 1
9 8 adantr N P 2 P FermatNo N P 2 2 N + 1
10 9 biimpa N P 2 P FermatNo N P 2 2 N + 1
11 dvdsmod0 P P 2 2 N + 1 2 2 N + 1 mod P = 0
12 4 10 11 syl2anc N P 2 P FermatNo N 2 2 N + 1 mod P = 0
13 12 ex N P 2 P FermatNo N 2 2 N + 1 mod P = 0
14 2nn 2
15 14 a1i N 2
16 2nn0 2 0
17 16 a1i N 2 0
18 17 5 nn0expcld N 2 N 0
19 15 18 nnexpcld N 2 2 N
20 19 nnzd N 2 2 N
21 20 adantr N P 2 2 2 N
22 1zzd N P 2 1
23 3 adantl N P 2 P
24 summodnegmod 2 2 N 1 P 2 2 N + 1 mod P = 0 2 2 N mod P = -1 mod P
25 21 22 23 24 syl3anc N P 2 2 2 N + 1 mod P = 0 2 2 N mod P = -1 mod P
26 neg1z 1
27 21 26 jctir N P 2 2 2 N 1
28 27 adantr N P 2 2 2 N mod P = -1 mod P 2 2 N 1
29 2 nnrpd P P +
30 1 29 syl P 2 P +
31 17 30 anim12i N P 2 2 0 P +
32 31 adantr N P 2 2 2 N mod P = -1 mod P 2 0 P +
33 simpr N P 2 2 2 N mod P = -1 mod P 2 2 N mod P = -1 mod P
34 modexp 2 2 N 1 2 0 P + 2 2 N mod P = -1 mod P 2 2 N 2 mod P = 1 2 mod P
35 28 32 33 34 syl3anc N P 2 2 2 N mod P = -1 mod P 2 2 N 2 mod P = 1 2 mod P
36 35 ex N P 2 2 2 N mod P = -1 mod P 2 2 N 2 mod P = 1 2 mod P
37 2cnd N 2
38 37 18 17 3jca N 2 2 N 0 2 0
39 38 adantr N P 2 2 2 N 0 2 0
40 expmul 2 2 N 0 2 0 2 2 N 2 = 2 2 N 2
41 39 40 syl N P 2 2 2 N 2 = 2 2 N 2
42 2cnd N P 2 2
43 5 adantr N P 2 N 0
44 42 43 expp1d N P 2 2 N + 1 = 2 N 2
45 44 eqcomd N P 2 2 N 2 = 2 N + 1
46 45 oveq2d N P 2 2 2 N 2 = 2 2 N + 1
47 41 46 eqtr3d N P 2 2 2 N 2 = 2 2 N + 1
48 47 oveq1d N P 2 2 2 N 2 mod P = 2 2 N + 1 mod P
49 neg1sqe1 1 2 = 1
50 49 a1i N P 2 1 2 = 1
51 50 oveq1d N P 2 1 2 mod P = 1 mod P
52 3 nnred P 2 P
53 prmgt1 P 1 < P
54 1 53 syl P 2 1 < P
55 1mod P 1 < P 1 mod P = 1
56 52 54 55 syl2anc P 2 1 mod P = 1
57 56 adantl N P 2 1 mod P = 1
58 51 57 eqtrd N P 2 1 2 mod P = 1
59 48 58 eqeq12d N P 2 2 2 N 2 mod P = 1 2 mod P 2 2 N + 1 mod P = 1
60 simpll N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 N P 2
61 20 adantr N P 2 2 N
62 1zzd N P 1
63 2 adantl N P P
64 61 62 63 3jca N P 2 2 N 1 P
65 1 64 sylan2 N P 2 2 2 N 1 P
66 65 adantr N P 2 2 2 N + 1 mod P = 1 2 2 N 1 P
67 66 24 syl N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 2 2 N mod P = -1 mod P
68 m1modnnsub1 P -1 mod P = P 1
69 23 68 syl N P 2 -1 mod P = P 1
70 eldifsni P 2 P 2
71 70 adantl N P 2 P 2
72 71 necomd N P 2 2 P
73 3 nncnd P 2 P
74 73 adantl N P 2 P
75 1cnd N P 2 1
76 74 75 75 subadd2d N P 2 P 1 = 1 1 + 1 = P
77 1p1e2 1 + 1 = 2
78 77 eqeq1i 1 + 1 = P 2 = P
79 76 78 bitrdi N P 2 P 1 = 1 2 = P
80 79 necon3bid N P 2 P 1 1 2 P
81 72 80 mpbird N P 2 P 1 1
82 69 81 eqnetrd N P 2 -1 mod P 1
83 82 adantr N P 2 2 2 N + 1 mod P = 1 -1 mod P 1
84 83 adantr N P 2 2 2 N + 1 mod P = 1 2 2 N mod P = -1 mod P -1 mod P 1
85 eqeq1 2 2 N mod P = -1 mod P 2 2 N mod P = 1 -1 mod P = 1
86 85 adantl N P 2 2 2 N + 1 mod P = 1 2 2 N mod P = -1 mod P 2 2 N mod P = 1 -1 mod P = 1
87 86 necon3bid N P 2 2 2 N + 1 mod P = 1 2 2 N mod P = -1 mod P 2 2 N mod P 1 -1 mod P 1
88 84 87 mpbird N P 2 2 2 N + 1 mod P = 1 2 2 N mod P = -1 mod P 2 2 N mod P 1
89 88 ex N P 2 2 2 N + 1 mod P = 1 2 2 N mod P = -1 mod P 2 2 N mod P 1
90 67 89 sylbid N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 2 2 N mod P 1
91 90 imp N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 2 2 N mod P 1
92 simplr N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 2 2 N + 1 mod P = 1
93 odz2prm2pw N P 2 2 2 N mod P 1 2 2 N + 1 mod P = 1 od P 2 = 2 N + 1
94 60 91 92 93 syl12anc N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
95 94 ex N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
96 95 ex N P 2 2 2 N + 1 mod P = 1 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
97 59 96 sylbid N P 2 2 2 N 2 mod P = 1 2 mod P 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
98 36 97 syld N P 2 2 2 N mod P = -1 mod P 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
99 25 98 sylbid N P 2 2 2 N + 1 mod P = 0 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
100 99 pm2.43d N P 2 2 2 N + 1 mod P = 0 od P 2 = 2 N + 1
101 13 100 syld N P 2 P FermatNo N od P 2 = 2 N + 1
102 101 3impia N P 2 P FermatNo N od P 2 = 2 N + 1