Metamath Proof Explorer


Theorem 2pwp1prm

Description: For ( ( 2 ^ k ) + 1 ) to be prime, k must be a power of 2, see Wikipedia "Fermat number", section "Other theorms about Fermat numbers", https://en.wikipedia.org/wiki/Fermat_number , 5-Aug-2021. (Contributed by AV, 7-Aug-2021)

Ref Expression
Assertion 2pwp1prm K 2 K + 1 n 0 K = 2 n

Proof

Step Hyp Ref Expression
1 oddprmdvds K ¬ n 0 K = 2 n p 2 p K
2 1 adantlr K 2 K + 1 ¬ n 0 K = 2 n p 2 p K
3 eldifi p 2 p
4 prmnn p p
5 3 4 syl p 2 p
6 simpl K 2 K + 1 K
7 nndivides p K p K m m p = K
8 5 6 7 syl2anr K 2 K + 1 p 2 p K m m p = K
9 2re 2
10 9 a1i m 2
11 nnnn0 m m 0
12 1le2 1 2
13 12 a1i m 1 2
14 10 11 13 expge1d m 1 2 m
15 1zzd m 1
16 2nn 2
17 16 a1i m 2
18 17 11 nnexpcld m 2 m
19 18 nnzd m 2 m
20 zleltp1 1 2 m 1 2 m 1 < 2 m + 1
21 15 19 20 syl2anc m 1 2 m 1 < 2 m + 1
22 14 21 mpbid m 1 < 2 m + 1
23 18 nncnd m 2 m
24 1cnd m 1
25 subneg 2 m 1 2 m -1 = 2 m + 1
26 25 breq2d 2 m 1 1 < 2 m -1 1 < 2 m + 1
27 23 24 26 syl2anc m 1 < 2 m -1 1 < 2 m + 1
28 22 27 mpbird m 1 < 2 m -1
29 28 adantl p 2 m 1 < 2 m -1
30 29 ad2antlr K p 2 m m p = K 1 < 2 m -1
31 18 nnred m 2 m
32 31 adantl p 2 m 2 m
33 16 a1i p 2 m 2
34 11 adantl p 2 m m 0
35 5 nnnn0d p 2 p 0
36 35 adantr p 2 m p 0
37 34 36 nn0mulcld p 2 m m p 0
38 33 37 nnexpcld p 2 m 2 m p
39 38 nnred p 2 m 2 m p
40 1red p 2 m 1
41 9 a1i p 2 m 2
42 nnz m m
43 42 adantl p 2 m m
44 5 nnzd p 2 p
45 44 adantr p 2 m p
46 43 45 zmulcld p 2 m m p
47 1lt2 1 < 2
48 47 a1i p 2 m 1 < 2
49 prmgt1 p 1 < p
50 3 49 syl p 2 1 < p
51 50 adantr p 2 m 1 < p
52 nnre m m
53 52 adantl p 2 m m
54 5 nnred p 2 p
55 54 adantr p 2 m p
56 nngt0 m 0 < m
57 56 adantl p 2 m 0 < m
58 ltmulgt11 m p 0 < m 1 < p m < m p
59 53 55 57 58 syl3anc p 2 m 1 < p m < m p
60 51 59 mpbid p 2 m m < m p
61 ltexp2a 2 m m p 1 < 2 m < m p 2 m < 2 m p
62 41 43 46 48 60 61 syl32anc p 2 m 2 m < 2 m p
63 32 39 40 62 ltadd1dd p 2 m 2 m + 1 < 2 m p + 1
64 63 ad2antlr K p 2 m m p = K 2 m + 1 < 2 m p + 1
65 23 24 subnegd m 2 m -1 = 2 m + 1
66 65 eqcomd m 2 m + 1 = 2 m -1
67 66 adantl p 2 m 2 m + 1 = 2 m -1
68 67 ad2antlr K p 2 m m p = K 2 m + 1 = 2 m -1
69 oveq2 m p = K 2 m p = 2 K
70 69 oveq1d m p = K 2 m p + 1 = 2 K + 1
71 70 adantl K p 2 m m p = K 2 m p + 1 = 2 K + 1
72 64 68 71 3brtr3d K p 2 m m p = K 2 m -1 < 2 K + 1
73 neg1z 1
74 73 a1i m 1
75 19 74 zsubcld m 2 m -1
76 75 adantl p 2 m 2 m -1
77 fzofi 0 ..^ p Fin
78 77 a1i p 2 m 0 ..^ p Fin
79 19 adantl p 2 m 2 m
80 elfzonn0 k 0 ..^ p k 0
81 zexpcl 2 m k 0 2 m k
82 79 80 81 syl2an p 2 m k 0 ..^ p 2 m k
83 73 a1i p 2 m k 0 ..^ p 1
84 fzonnsub k 0 ..^ p p k
85 84 adantl p 2 m k 0 ..^ p p k
86 nnm1nn0 p k p - k - 1 0
87 85 86 syl p 2 m k 0 ..^ p p - k - 1 0
88 zexpcl 1 p - k - 1 0 1 p - k - 1
89 83 87 88 syl2anc p 2 m k 0 ..^ p 1 p - k - 1
90 82 89 zmulcld p 2 m k 0 ..^ p 2 m k 1 p - k - 1
91 78 90 fsumzcl p 2 m k 0 ..^ p 2 m k 1 p - k - 1
92 dvdsmul1 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1 2 m -1 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
93 76 91 92 syl2anc p 2 m 2 m -1 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
94 93 ad2antlr K p 2 m m p = K 2 m -1 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
95 23 adantl p 2 m 2 m
96 neg1cn 1
97 96 a1i p 2 m 1
98 pwdif p 0 2 m 1 2 m p 1 p = 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
99 36 95 97 98 syl3anc p 2 m 2 m p 1 p = 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
100 99 breq2d p 2 m 2 m -1 2 m p 1 p 2 m -1 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
101 100 ad2antlr K p 2 m m p = K 2 m -1 2 m p 1 p 2 m -1 2 m -1 k 0 ..^ p 2 m k 1 p - k - 1
102 94 101 mpbird K p 2 m m p = K 2 m -1 2 m p 1 p
103 2cnd K 2
104 nnnn0 K K 0
105 103 104 expcld K 2 K
106 1cnd K 1
107 105 106 subnegd K 2 K -1 = 2 K + 1
108 107 eqcomd K 2 K + 1 = 2 K -1
109 108 adantr K p 2 m 2 K + 1 = 2 K -1
110 109 adantr K p 2 m m p = K 2 K + 1 = 2 K -1
111 oveq2 K = m p 2 K = 2 m p
112 111 eqcoms m p = K 2 K = 2 m p
113 112 adantl K p 2 m m p = K 2 K = 2 m p
114 2cnd p 2 m 2
115 114 36 34 expmuld p 2 m 2 m p = 2 m p
116 115 ad2antlr K p 2 m m p = K 2 m p = 2 m p
117 113 116 eqtrd K p 2 m m p = K 2 K = 2 m p
118 1exp p 1 p = 1
119 44 118 syl p 2 1 p = 1
120 119 eqcomd p 2 1 = 1 p
121 120 negeqd p 2 1 = 1 p
122 1cnd p 2 1
123 oddn2prm p 2 ¬ 2 p
124 oexpneg 1 p ¬ 2 p 1 p = 1 p
125 122 5 123 124 syl3anc p 2 1 p = 1 p
126 125 eqcomd p 2 1 p = 1 p
127 121 126 eqtrd p 2 1 = 1 p
128 127 adantr p 2 m 1 = 1 p
129 128 ad2antlr K p 2 m m p = K 1 = 1 p
130 117 129 oveq12d K p 2 m m p = K 2 K -1 = 2 m p 1 p
131 110 130 eqtrd K p 2 m m p = K 2 K + 1 = 2 m p 1 p
132 131 breq2d K p 2 m m p = K 2 m -1 2 K + 1 2 m -1 2 m p 1 p
133 102 132 mpbird K p 2 m m p = K 2 m -1 2 K + 1
134 30 72 133 dvdsnprmd K p 2 m m p = K ¬ 2 K + 1
135 134 pm2.21d K p 2 m m p = K 2 K + 1 n 0 K = 2 n
136 135 ex K p 2 m m p = K 2 K + 1 n 0 K = 2 n
137 136 com23 K p 2 m 2 K + 1 m p = K n 0 K = 2 n
138 137 impancom K 2 K + 1 p 2 m m p = K n 0 K = 2 n
139 138 impl K 2 K + 1 p 2 m m p = K n 0 K = 2 n
140 139 rexlimdva K 2 K + 1 p 2 m m p = K n 0 K = 2 n
141 8 140 sylbid K 2 K + 1 p 2 p K n 0 K = 2 n
142 141 rexlimdva K 2 K + 1 p 2 p K n 0 K = 2 n
143 142 adantr K 2 K + 1 ¬ n 0 K = 2 n p 2 p K n 0 K = 2 n
144 2 143 mpd K 2 K + 1 ¬ n 0 K = 2 n n 0 K = 2 n
145 144 pm2.18da K 2 K + 1 n 0 K = 2 n