Metamath Proof Explorer


Theorem fpprwpprb

Description: An integer X which is coprime with an integer N is a Fermat pseudoprime to the base N iff it is a weak pseudoprime to the base N . (Contributed by AV, 2-Jun-2023)

Ref Expression
Assertion fpprwpprb X gcd N = 1 X FPPr N X 4 X N N X mod X = N mod X

Proof

Step Hyp Ref Expression
1 fpprbasnn X FPPr N N
2 fpprel N X FPPr N X 4 X N X 1 mod X = 1
3 3simpa X 4 X N X 1 mod X = 1 X 4 X
4 3 a1i N X 4 X N X 1 mod X = 1 X 4 X
5 2 4 sylbid N X FPPr N X 4 X
6 1 5 mpcom X FPPr N X 4 X
7 fpprwppr X FPPr N N X mod X = N mod X
8 1 7 jca X FPPr N N N X mod X = N mod X
9 6 8 jca X FPPr N X 4 X N N X mod X = N mod X
10 simprll X gcd N = 1 X 4 X N N X mod X = N mod X X 4
11 simprlr X gcd N = 1 X 4 X N N X mod X = N mod X X
12 eluz4nn X 4 X
13 12 adantr X 4 N X
14 nnz N N
15 12 nnnn0d X 4 X 0
16 zexpcl N X 0 N X
17 14 15 16 syl2anr X 4 N N X
18 14 adantl X 4 N N
19 moddvds X N X N N X mod X = N mod X X N X N
20 13 17 18 19 syl3anc X 4 N N X mod X = N mod X X N X N
21 nncn N N
22 expm1t N X N X = N X 1 N
23 21 12 22 syl2anr X 4 N N X = N X 1 N
24 23 oveq1d X 4 N N X N = N X 1 N N
25 nnm1nn0 X X 1 0
26 12 25 syl X 4 X 1 0
27 zexpcl N X 1 0 N X 1
28 14 26 27 syl2anr X 4 N N X 1
29 28 zcnd X 4 N N X 1
30 21 adantl X 4 N N
31 29 30 mulsubfacd X 4 N N X 1 N N = N X 1 1 N
32 24 31 eqtrd X 4 N N X N = N X 1 1 N
33 32 breq2d X 4 N X N X N X N X 1 1 N
34 1zzd X 4 N 1
35 28 34 zsubcld X 4 N N X 1 1
36 dvdsmulgcd N X 1 1 N X N X 1 1 N X N X 1 1 N gcd X
37 35 18 36 syl2anc X 4 N X N X 1 1 N X N X 1 1 N gcd X
38 eluzelz X 4 X
39 gcdcom X N X gcd N = N gcd X
40 38 14 39 syl2an X 4 N X gcd N = N gcd X
41 40 eqeq1d X 4 N X gcd N = 1 N gcd X = 1
42 41 biimpd X 4 N X gcd N = 1 N gcd X = 1
43 42 imp X 4 N X gcd N = 1 N gcd X = 1
44 43 oveq2d X 4 N X gcd N = 1 N X 1 1 N gcd X = N X 1 1 1
45 35 zcnd X 4 N N X 1 1
46 45 mulid1d X 4 N N X 1 1 1 = N X 1 1
47 46 adantr X 4 N X gcd N = 1 N X 1 1 1 = N X 1 1
48 44 47 eqtrd X 4 N X gcd N = 1 N X 1 1 N gcd X = N X 1 1
49 48 breq2d X 4 N X gcd N = 1 X N X 1 1 N gcd X X N X 1 1
50 49 biimpd X 4 N X gcd N = 1 X N X 1 1 N gcd X X N X 1 1
51 50 ex X 4 N X gcd N = 1 X N X 1 1 N gcd X X N X 1 1
52 51 com23 X 4 N X N X 1 1 N gcd X X gcd N = 1 X N X 1 1
53 37 52 sylbid X 4 N X N X 1 1 N X gcd N = 1 X N X 1 1
54 33 53 sylbid X 4 N X N X N X gcd N = 1 X N X 1 1
55 20 54 sylbid X 4 N N X mod X = N mod X X gcd N = 1 X N X 1 1
56 55 expimpd X 4 N N X mod X = N mod X X gcd N = 1 X N X 1 1
57 56 adantr X 4 X N N X mod X = N mod X X gcd N = 1 X N X 1 1
58 57 imp X 4 X N N X mod X = N mod X X gcd N = 1 X N X 1 1
59 58 impcom X gcd N = 1 X 4 X N N X mod X = N mod X X N X 1 1
60 eluz4eluz2 X 4 X 2
61 60 adantr X 4 X X 2
62 61 adantr X 4 X N N X mod X = N mod X X 2
63 14 adantr N N X mod X = N mod X N
64 26 adantr X 4 X X 1 0
65 63 64 27 syl2anr X 4 X N N X mod X = N mod X N X 1
66 62 65 jca X 4 X N N X mod X = N mod X X 2 N X 1
67 66 adantl X gcd N = 1 X 4 X N N X mod X = N mod X X 2 N X 1
68 modm1div X 2 N X 1 N X 1 mod X = 1 X N X 1 1
69 67 68 syl X gcd N = 1 X 4 X N N X mod X = N mod X N X 1 mod X = 1 X N X 1 1
70 59 69 mpbird X gcd N = 1 X 4 X N N X mod X = N mod X N X 1 mod X = 1
71 2 adantr N N X mod X = N mod X X FPPr N X 4 X N X 1 mod X = 1
72 71 adantl X 4 X N N X mod X = N mod X X FPPr N X 4 X N X 1 mod X = 1
73 72 adantl X gcd N = 1 X 4 X N N X mod X = N mod X X FPPr N X 4 X N X 1 mod X = 1
74 10 11 70 73 mpbir3and X gcd N = 1 X 4 X N N X mod X = N mod X X FPPr N
75 74 ex X gcd N = 1 X 4 X N N X mod X = N mod X X FPPr N
76 9 75 impbid2 X gcd N = 1 X FPPr N X 4 X N N X mod X = N mod X