Metamath Proof Explorer


Theorem odz2prm2pw

Description: Any power of two is coprime to any prime not being two. (Contributed by AV, 25-Jul-2021)

Ref Expression
Assertion odz2prm2pw N P 2 2 2 N mod P 1 2 2 N + 1 mod P = 1 od P 2 = 2 N + 1

Proof

Step Hyp Ref Expression
1 eldifi P 2 P
2 2nn 2
3 2 a1i N 2
4 2nn0 2 0
5 4 a1i N 2 0
6 peano2nn N N + 1
7 6 nnnn0d N N + 1 0
8 5 7 nn0expcld N 2 N + 1 0
9 3 8 nnexpcld N 2 2 N + 1
10 9 nnzd N 2 2 N + 1
11 modprm1div P 2 2 N + 1 2 2 N + 1 mod P = 1 P 2 2 N + 1 1
12 1 10 11 syl2anr N P 2 2 2 N + 1 mod P = 1 P 2 2 N + 1 1
13 prmnn P P
14 1 13 syl P 2 P
15 14 adantl N P 2 P
16 2z 2
17 16 a1i N P 2 2
18 eldifsn P 2 P P 2
19 simpr P P 2 P 2
20 19 necomd P P 2 2 P
21 18 20 sylbi P 2 2 P
22 2prm 2
23 prmrp 2 P 2 gcd P = 1 2 P
24 22 1 23 sylancr P 2 2 gcd P = 1 2 P
25 21 24 mpbird P 2 2 gcd P = 1
26 25 adantl N P 2 2 gcd P = 1
27 15 17 26 3jca N P 2 P 2 2 gcd P = 1
28 8 adantr N P 2 2 N + 1 0
29 odzdvds P 2 2 gcd P = 1 2 N + 1 0 P 2 2 N + 1 1 od P 2 2 N + 1
30 27 28 29 syl2anc N P 2 P 2 2 N + 1 1 od P 2 2 N + 1
31 12 30 bitrd N P 2 2 2 N + 1 mod P = 1 od P 2 2 N + 1
32 nnnn0 N N 0
33 5 32 nn0expcld N 2 N 0
34 3 33 nnexpcld N 2 2 N
35 34 nnzd N 2 2 N
36 modprm1div P 2 2 N 2 2 N mod P = 1 P 2 2 N 1
37 1 35 36 syl2anr N P 2 2 2 N mod P = 1 P 2 2 N 1
38 33 adantr N P 2 2 N 0
39 odzdvds P 2 2 gcd P = 1 2 N 0 P 2 2 N 1 od P 2 2 N
40 27 38 39 syl2anc N P 2 P 2 2 N 1 od P 2 2 N
41 37 40 bitrd N P 2 2 2 N mod P = 1 od P 2 2 N
42 41 necon3abid N P 2 2 2 N mod P 1 ¬ od P 2 2 N
43 odzcl P 2 2 gcd P = 1 od P 2
44 27 43 syl N P 2 od P 2
45 7 adantr N P 2 N + 1 0
46 dvdsprmpweqle 2 od P 2 N + 1 0 od P 2 2 N + 1 n 0 n N + 1 od P 2 = 2 n
47 22 44 45 46 mp3an2i N P 2 od P 2 2 N + 1 n 0 n N + 1 od P 2 = 2 n
48 breq1 od P 2 = 2 n od P 2 2 N 2 n 2 N
49 48 adantl N P 2 n 0 n N + 1 od P 2 = 2 n od P 2 2 N 2 n 2 N
50 49 notbid N P 2 n 0 n N + 1 od P 2 = 2 n ¬ od P 2 2 N ¬ 2 n 2 N
51 simpr N P 2 n 0 n N + 1 od P 2 = 2 n od P 2 = 2 n
52 51 adantr N P 2 n 0 n N + 1 od P 2 = 2 n ¬ 2 n 2 N od P 2 = 2 n
53 nn0re n 0 n
54 6 nnred N N + 1
55 54 adantr N P 2 N + 1
56 leloe n N + 1 n N + 1 n < N + 1 n = N + 1
57 53 55 56 syl2anr N P 2 n 0 n N + 1 n < N + 1 n = N + 1
58 simpr N P 2 n 0 n 0
59 nn0z n 0 n
60 59 adantl N P 2 n 0 n
61 60 adantr N P 2 n 0 n < N + 1 n
62 nnz N N
63 62 adantr N P 2 N
64 63 adantr N P 2 n 0 N
65 64 adantr N P 2 n 0 n < N + 1 N
66 zleltp1 n N n N n < N + 1
67 59 63 66 syl2anr N P 2 n 0 n N n < N + 1
68 67 biimpar N P 2 n 0 n < N + 1 n N
69 eluz2 N n n N n N
70 61 65 68 69 syl3anbrc N P 2 n 0 n < N + 1 N n
71 dvdsexp 2 n 0 N n 2 n 2 N
72 16 58 70 71 mp3an2ani N P 2 n 0 n < N + 1 2 n 2 N
73 72 pm2.24d N P 2 n 0 n < N + 1 ¬ 2 n 2 N 2 n = 2 N + 1
74 73 expcom n < N + 1 N P 2 n 0 ¬ 2 n 2 N 2 n = 2 N + 1
75 oveq2 n = N + 1 2 n = 2 N + 1
76 75 2a1d n = N + 1 N P 2 n 0 ¬ 2 n 2 N 2 n = 2 N + 1
77 74 76 jaoi n < N + 1 n = N + 1 N P 2 n 0 ¬ 2 n 2 N 2 n = 2 N + 1
78 77 com12 N P 2 n 0 n < N + 1 n = N + 1 ¬ 2 n 2 N 2 n = 2 N + 1
79 57 78 sylbid N P 2 n 0 n N + 1 ¬ 2 n 2 N 2 n = 2 N + 1
80 79 imp N P 2 n 0 n N + 1 ¬ 2 n 2 N 2 n = 2 N + 1
81 80 adantr N P 2 n 0 n N + 1 od P 2 = 2 n ¬ 2 n 2 N 2 n = 2 N + 1
82 81 imp N P 2 n 0 n N + 1 od P 2 = 2 n ¬ 2 n 2 N 2 n = 2 N + 1
83 52 82 eqtrd N P 2 n 0 n N + 1 od P 2 = 2 n ¬ 2 n 2 N od P 2 = 2 N + 1
84 83 ex N P 2 n 0 n N + 1 od P 2 = 2 n ¬ 2 n 2 N od P 2 = 2 N + 1
85 50 84 sylbid N P 2 n 0 n N + 1 od P 2 = 2 n ¬ od P 2 2 N od P 2 = 2 N + 1
86 85 expl N P 2 n 0 n N + 1 od P 2 = 2 n ¬ od P 2 2 N od P 2 = 2 N + 1
87 86 rexlimdva N P 2 n 0 n N + 1 od P 2 = 2 n ¬ od P 2 2 N od P 2 = 2 N + 1
88 47 87 syld N P 2 od P 2 2 N + 1 ¬ od P 2 2 N od P 2 = 2 N + 1
89 88 com23 N P 2 ¬ od P 2 2 N od P 2 2 N + 1 od P 2 = 2 N + 1
90 42 89 sylbid N P 2 2 2 N mod P 1 od P 2 2 N + 1 od P 2 = 2 N + 1
91 90 com23 N P 2 od P 2 2 N + 1 2 2 N mod P 1 od P 2 = 2 N + 1
92 31 91 sylbid N P 2 2 2 N + 1 mod P = 1 2 2 N mod P 1 od P 2 = 2 N + 1
93 92 com23 N P 2 2 2 N mod P 1 2 2 N + 1 mod P = 1 od P 2 = 2 N + 1
94 93 imp32 N P 2 2 2 N mod P 1 2 2 N + 1 mod P = 1 od P 2 = 2 N + 1