Metamath Proof Explorer


Theorem mersenne

Description: A Mersenne prime is a prime number of the form 2 ^ P - 1 . This theorem shows that the P in this expression is necessarily also prime. (Contributed by Mario Carneiro, 17-May-2016)

Ref Expression
Assertion mersenne
|- ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> P e. Prime )

Proof

Step Hyp Ref Expression
1 simpl
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> P e. ZZ )
2 2nn0
 |-  2 e. NN0
3 2 numexp1
 |-  ( 2 ^ 1 ) = 2
4 df-2
 |-  2 = ( 1 + 1 )
5 3 4 eqtri
 |-  ( 2 ^ 1 ) = ( 1 + 1 )
6 prmuz2
 |-  ( ( ( 2 ^ P ) - 1 ) e. Prime -> ( ( 2 ^ P ) - 1 ) e. ( ZZ>= ` 2 ) )
7 6 adantl
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( ( 2 ^ P ) - 1 ) e. ( ZZ>= ` 2 ) )
8 eluz2gt1
 |-  ( ( ( 2 ^ P ) - 1 ) e. ( ZZ>= ` 2 ) -> 1 < ( ( 2 ^ P ) - 1 ) )
9 7 8 syl
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 1 < ( ( 2 ^ P ) - 1 ) )
10 1red
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 1 e. RR )
11 2re
 |-  2 e. RR
12 11 a1i
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 2 e. RR )
13 2ne0
 |-  2 =/= 0
14 13 a1i
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 2 =/= 0 )
15 12 14 1 reexpclzd
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( 2 ^ P ) e. RR )
16 10 10 15 ltaddsubd
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( ( 1 + 1 ) < ( 2 ^ P ) <-> 1 < ( ( 2 ^ P ) - 1 ) ) )
17 9 16 mpbird
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( 1 + 1 ) < ( 2 ^ P ) )
18 5 17 eqbrtrid
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( 2 ^ 1 ) < ( 2 ^ P ) )
19 1zzd
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 1 e. ZZ )
20 1lt2
 |-  1 < 2
21 20 a1i
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 1 < 2 )
22 12 19 1 21 ltexp2d
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( 1 < P <-> ( 2 ^ 1 ) < ( 2 ^ P ) ) )
23 18 22 mpbird
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> 1 < P )
24 eluz2b1
 |-  ( P e. ( ZZ>= ` 2 ) <-> ( P e. ZZ /\ 1 < P ) )
25 1 23 24 sylanbrc
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> P e. ( ZZ>= ` 2 ) )
26 simpllr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ P ) - 1 ) e. Prime )
27 prmnn
 |-  ( ( ( 2 ^ P ) - 1 ) e. Prime -> ( ( 2 ^ P ) - 1 ) e. NN )
28 26 27 syl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ P ) - 1 ) e. NN )
29 28 nncnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ P ) - 1 ) e. CC )
30 2nn
 |-  2 e. NN
31 elfzuz
 |-  ( k e. ( 2 ... ( P - 1 ) ) -> k e. ( ZZ>= ` 2 ) )
32 31 ad2antlr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k e. ( ZZ>= ` 2 ) )
33 eluz2nn
 |-  ( k e. ( ZZ>= ` 2 ) -> k e. NN )
34 32 33 syl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k e. NN )
35 34 nnnn0d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k e. NN0 )
36 nnexpcl
 |-  ( ( 2 e. NN /\ k e. NN0 ) -> ( 2 ^ k ) e. NN )
37 30 35 36 sylancr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ k ) e. NN )
38 37 nnzd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ k ) e. ZZ )
39 peano2zm
 |-  ( ( 2 ^ k ) e. ZZ -> ( ( 2 ^ k ) - 1 ) e. ZZ )
40 38 39 syl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) e. ZZ )
41 40 zred
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) e. RR )
42 41 recnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) e. CC )
43 0red
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 0 e. RR )
44 1red
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 1 e. RR )
45 0lt1
 |-  0 < 1
46 45 a1i
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 0 < 1 )
47 eluz2gt1
 |-  ( k e. ( ZZ>= ` 2 ) -> 1 < k )
48 32 47 syl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 1 < k )
49 11 a1i
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 2 e. RR )
50 1zzd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 1 e. ZZ )
51 elfzelz
 |-  ( k e. ( 2 ... ( P - 1 ) ) -> k e. ZZ )
52 51 ad2antlr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k e. ZZ )
53 20 a1i
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 1 < 2 )
54 49 50 52 53 ltexp2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 1 < k <-> ( 2 ^ 1 ) < ( 2 ^ k ) ) )
55 48 54 mpbid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ 1 ) < ( 2 ^ k ) )
56 5 55 eqbrtrrid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 1 + 1 ) < ( 2 ^ k ) )
57 37 nnred
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ k ) e. RR )
58 44 44 57 ltaddsubd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 1 + 1 ) < ( 2 ^ k ) <-> 1 < ( ( 2 ^ k ) - 1 ) ) )
59 56 58 mpbid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 1 < ( ( 2 ^ k ) - 1 ) )
60 43 44 41 46 59 lttrd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 0 < ( ( 2 ^ k ) - 1 ) )
61 elnnz
 |-  ( ( ( 2 ^ k ) - 1 ) e. NN <-> ( ( ( 2 ^ k ) - 1 ) e. ZZ /\ 0 < ( ( 2 ^ k ) - 1 ) ) )
62 40 60 61 sylanbrc
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) e. NN )
63 62 nnne0d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) =/= 0 )
64 29 42 63 divcan2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( ( 2 ^ k ) - 1 ) x. ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) = ( ( 2 ^ P ) - 1 ) )
65 64 26 eqeltrd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( ( 2 ^ k ) - 1 ) x. ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) e. Prime )
66 eluz2b2
 |-  ( ( ( 2 ^ k ) - 1 ) e. ( ZZ>= ` 2 ) <-> ( ( ( 2 ^ k ) - 1 ) e. NN /\ 1 < ( ( 2 ^ k ) - 1 ) ) )
67 62 59 66 sylanbrc
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) e. ( ZZ>= ` 2 ) )
68 37 nncnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ k ) e. CC )
69 ax-1cn
 |-  1 e. CC
70 subeq0
 |-  ( ( ( 2 ^ k ) e. CC /\ 1 e. CC ) -> ( ( ( 2 ^ k ) - 1 ) = 0 <-> ( 2 ^ k ) = 1 ) )
71 68 69 70 sylancl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( ( 2 ^ k ) - 1 ) = 0 <-> ( 2 ^ k ) = 1 ) )
72 71 necon3bid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( ( 2 ^ k ) - 1 ) =/= 0 <-> ( 2 ^ k ) =/= 1 ) )
73 63 72 mpbid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ k ) =/= 1 )
74 simpr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k || P )
75 eluz2nn
 |-  ( P e. ( ZZ>= ` 2 ) -> P e. NN )
76 25 75 syl
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> P e. NN )
77 76 ad2antrr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> P e. NN )
78 nndivdvds
 |-  ( ( P e. NN /\ k e. NN ) -> ( k || P <-> ( P / k ) e. NN ) )
79 77 34 78 syl2anc
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( k || P <-> ( P / k ) e. NN ) )
80 74 79 mpbid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( P / k ) e. NN )
81 80 nnnn0d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( P / k ) e. NN0 )
82 68 73 81 geoser
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> sum_ n e. ( 0 ... ( ( P / k ) - 1 ) ) ( ( 2 ^ k ) ^ n ) = ( ( 1 - ( ( 2 ^ k ) ^ ( P / k ) ) ) / ( 1 - ( 2 ^ k ) ) ) )
83 15 ad2antrr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ P ) e. RR )
84 83 recnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ P ) e. CC )
85 negsubdi2
 |-  ( ( ( 2 ^ P ) e. CC /\ 1 e. CC ) -> -u ( ( 2 ^ P ) - 1 ) = ( 1 - ( 2 ^ P ) ) )
86 84 69 85 sylancl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> -u ( ( 2 ^ P ) - 1 ) = ( 1 - ( 2 ^ P ) ) )
87 77 nncnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> P e. CC )
88 34 nncnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k e. CC )
89 34 nnne0d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k =/= 0 )
90 87 88 89 divcan2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( k x. ( P / k ) ) = P )
91 90 oveq2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ ( k x. ( P / k ) ) ) = ( 2 ^ P ) )
92 49 recnd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 2 e. CC )
93 92 81 35 expmuld
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ ( k x. ( P / k ) ) ) = ( ( 2 ^ k ) ^ ( P / k ) ) )
94 91 93 eqtr3d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ P ) = ( ( 2 ^ k ) ^ ( P / k ) ) )
95 94 oveq2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 1 - ( 2 ^ P ) ) = ( 1 - ( ( 2 ^ k ) ^ ( P / k ) ) ) )
96 86 95 eqtrd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> -u ( ( 2 ^ P ) - 1 ) = ( 1 - ( ( 2 ^ k ) ^ ( P / k ) ) ) )
97 negsubdi2
 |-  ( ( ( 2 ^ k ) e. CC /\ 1 e. CC ) -> -u ( ( 2 ^ k ) - 1 ) = ( 1 - ( 2 ^ k ) ) )
98 68 69 97 sylancl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> -u ( ( 2 ^ k ) - 1 ) = ( 1 - ( 2 ^ k ) ) )
99 96 98 oveq12d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( -u ( ( 2 ^ P ) - 1 ) / -u ( ( 2 ^ k ) - 1 ) ) = ( ( 1 - ( ( 2 ^ k ) ^ ( P / k ) ) ) / ( 1 - ( 2 ^ k ) ) ) )
100 29 42 63 div2negd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( -u ( ( 2 ^ P ) - 1 ) / -u ( ( 2 ^ k ) - 1 ) ) = ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) )
101 82 99 100 3eqtr2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> sum_ n e. ( 0 ... ( ( P / k ) - 1 ) ) ( ( 2 ^ k ) ^ n ) = ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) )
102 fzfid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 0 ... ( ( P / k ) - 1 ) ) e. Fin )
103 elfznn0
 |-  ( n e. ( 0 ... ( ( P / k ) - 1 ) ) -> n e. NN0 )
104 zexpcl
 |-  ( ( ( 2 ^ k ) e. ZZ /\ n e. NN0 ) -> ( ( 2 ^ k ) ^ n ) e. ZZ )
105 38 103 104 syl2an
 |-  ( ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) /\ n e. ( 0 ... ( ( P / k ) - 1 ) ) ) -> ( ( 2 ^ k ) ^ n ) e. ZZ )
106 102 105 fsumzcl
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> sum_ n e. ( 0 ... ( ( P / k ) - 1 ) ) ( ( 2 ^ k ) ^ n ) e. ZZ )
107 101 106 eqeltrrd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) e. ZZ )
108 42 mulid2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 1 x. ( ( 2 ^ k ) - 1 ) ) = ( ( 2 ^ k ) - 1 ) )
109 2z
 |-  2 e. ZZ
110 elfzm11
 |-  ( ( 2 e. ZZ /\ P e. ZZ ) -> ( k e. ( 2 ... ( P - 1 ) ) <-> ( k e. ZZ /\ 2 <_ k /\ k < P ) ) )
111 109 1 110 sylancr
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> ( k e. ( 2 ... ( P - 1 ) ) <-> ( k e. ZZ /\ 2 <_ k /\ k < P ) ) )
112 111 biimpa
 |-  ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) -> ( k e. ZZ /\ 2 <_ k /\ k < P ) )
113 112 simp3d
 |-  ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) -> k < P )
114 113 adantr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> k < P )
115 1 ad2antrr
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> P e. ZZ )
116 49 52 115 53 ltexp2d
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( k < P <-> ( 2 ^ k ) < ( 2 ^ P ) ) )
117 114 116 mpbid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 2 ^ k ) < ( 2 ^ P ) )
118 57 83 44 117 ltsub1dd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ k ) - 1 ) < ( ( 2 ^ P ) - 1 ) )
119 108 118 eqbrtrd
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( 1 x. ( ( 2 ^ k ) - 1 ) ) < ( ( 2 ^ P ) - 1 ) )
120 28 nnred
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 2 ^ P ) - 1 ) e. RR )
121 ltmuldiv
 |-  ( ( 1 e. RR /\ ( ( 2 ^ P ) - 1 ) e. RR /\ ( ( ( 2 ^ k ) - 1 ) e. RR /\ 0 < ( ( 2 ^ k ) - 1 ) ) ) -> ( ( 1 x. ( ( 2 ^ k ) - 1 ) ) < ( ( 2 ^ P ) - 1 ) <-> 1 < ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) )
122 44 120 41 60 121 syl112anc
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( 1 x. ( ( 2 ^ k ) - 1 ) ) < ( ( 2 ^ P ) - 1 ) <-> 1 < ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) )
123 119 122 mpbid
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> 1 < ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) )
124 eluz2b1
 |-  ( ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) e. ( ZZ>= ` 2 ) <-> ( ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) e. ZZ /\ 1 < ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) )
125 107 123 124 sylanbrc
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) e. ( ZZ>= ` 2 ) )
126 nprm
 |-  ( ( ( ( 2 ^ k ) - 1 ) e. ( ZZ>= ` 2 ) /\ ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) e. ( ZZ>= ` 2 ) ) -> -. ( ( ( 2 ^ k ) - 1 ) x. ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) e. Prime )
127 67 125 126 syl2anc
 |-  ( ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) /\ k || P ) -> -. ( ( ( 2 ^ k ) - 1 ) x. ( ( ( 2 ^ P ) - 1 ) / ( ( 2 ^ k ) - 1 ) ) ) e. Prime )
128 65 127 pm2.65da
 |-  ( ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) /\ k e. ( 2 ... ( P - 1 ) ) ) -> -. k || P )
129 128 ralrimiva
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> A. k e. ( 2 ... ( P - 1 ) ) -. k || P )
130 isprm3
 |-  ( P e. Prime <-> ( P e. ( ZZ>= ` 2 ) /\ A. k e. ( 2 ... ( P - 1 ) ) -. k || P ) )
131 25 129 130 sylanbrc
 |-  ( ( P e. ZZ /\ ( ( 2 ^ P ) - 1 ) e. Prime ) -> P e. Prime )