/- Copyright 2025 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import FormalConjecturesUtil

Agoh-Giuga conjecture

Reference: Wikipedia

open scoped Nat/- The **Agoh-Giuga Conjecture**. References: * Wikipedia: https://en.wikipedia.org/wiki/Agoh-Giuga_conjecture * Wikipedia: https://en.wikipedia.org/wiki/Giuga_number * G. Giuga, _Su una presumibile proprieta caratteristica dei numeri primi_ * E. Bedocchi, _Note on a conjecture about prime numbers_ * D. Borwein, J. M. Borwein, P. B. Borwein, and R. Girgensohn, _Giuga’s conjecture on primality_ * V. Tipu, _A Note on Giuga’s Conjecture_ -/ namespace AgohGiuga

The Agoh-Giuga Conjecture, Agoh's formulation. An integer p ≥ 2 is prime if and only if we have p*B_{p-1} ≡ -1 [MOD p]

def AgohGiugaCongr : Prop := p 2, p.Prime (k : ), let B := bernoulli' (p - 1) p * B.num + B.den = k * p^2

The Agoh-Giuga Conjecture, Giuga's formulation. An integer p ≥ 2 is prime if and only if it satifies the congruence ∑_{i=1}^{p-1} i^{p-1} ≡ -1 [MOD p].

def AgohGiugaSum : Prop := p 2, p.Prime p 1 + i Finset.Ioo 0 p, i^(p - 1 : )

The Agoh-Giuga Conjecture, Agoh's formulation

@[category research open, AMS 11] theorem declaration uses 'sorry'agoh_giuga : AgohGiugaCongr := AgohGiugaCongr All goals completed! 🐙

The Agoh-Giuga Conjecture, Giuga's formulation

@[category research open, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants.giuga : AgohGiugaSum := AgohGiugaSum All goals completed! 🐙

The two statements of the conjecture are equivalent.

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants.equivalence : AgohGiugaCongr AgohGiugaSum := AgohGiugaCongr AgohGiugaSum All goals completed! 🐙

A (weak) Giuga number is a composite number $n$ such that $$\sum_{i=1}^{n - 1}i^{\varphi(n)} \equiv -1\pmod{n}$$.

def IsWeakGiuga (n : ) : Prop := n.Composite n 1 + i Finset.Ioo 0 n, i ^ φ n

A (strong) Giuga number is a composite number $n$ such that $$\sum_{i=1}^{n - 1}i^{n - 1} \equiv -1\pmod{n}$$

def IsStrongGiuga (n : ) : Prop := n.Composite n 1 + i Finset.Ioo 0 n, i ^ (n - 1)

A composite number $n$ is weak Giuga if and only if $p \mid (\frac{n}{p} - 1)$ for all prime divisors $p$ of $n$.

@[category research solved, AMS 11, formal_proof using formal_conjectures at "https://github.com/mo271/formal-conjectures/blob/2663234a28260853790aa5752d8d4550ff0ab1ca/FormalConjectures/Wikipedia/AgohGiuga.lean#L97"] theorem declaration uses 'sorry'isWeakGiuga_iff_prime_dvd {n : } (hn : n.Composite) : IsWeakGiuga n p n.primeFactors, p (n / p - 1) := n:hn:n.CompositeIsWeakGiuga n p n.primeFactors, p n / p - 1 All goals completed! 🐙

A composite number $n$ is weak Giuga if and only if $$ \sum_{p\mid n} \frac{1}{p} - \frac{1}{n} \in\mathbb{N}. $$

@[category research solved, AMS 11] theorem declaration uses 'sorry'isWeakGiuga_iff_sum_primeFactors {n : } (hn : n.Composite) : IsWeakGiuga n m : , p n.primeFactors, (1 / p : ) - 1 / n = m := n:hn:n.CompositeIsWeakGiuga n m, p n.primeFactors, 1 / p - 1 / n = m All goals completed! 🐙

A composite Carmichael number is squarefree.

@[category textbook, AMS 11] theorem squarefree_of_isCarmichael {a : } (ha₁ : a.Composite) (ha₂ : IsCarmichael a) : Squarefree a := a:ha₁:a.Compositeha₂:IsCarmichael aSquarefree a a:ha₁:a.Compositeha₂:IsCarmichael aha₂_forall:IsCarmichael a := ha₂Squarefree a a:ha₁:1 < a ¬Nat.Prime aha₂: (b : ), 1 b a.Coprime b a b ^ (a - 1) - 1ha₂_forall: (b : ), 1 b a.Coprime b a b ^ (a - 1) - 1 (x : ), Nat.Prime x ¬x * x a p:hp:Nat.Prime pN:ha₁:1 < p * p * N ¬Nat.Prime (p * p * N)ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1False p:hp:Nat.Prime pN:ha₁:1 < p * p * N ¬Nat.Prime (p * p * N)ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1¬((p * p * N).Coprime (p * N + 1) p * p * N (p * N + 1) ^ (p * p * N - 1) - 1) p:hp:Nat.Prime pN:ha₁:1 < p * p * N ¬Nat.Prime (p * p * N)ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1this:Fact (Nat.Prime p) := { out := hp }¬((p * p * N).Coprime (p * N + 1) p * p * N (p * N + 1) ^ (p * p * N - 1) - 1) p:hp:Nat.Prime pN:ha₁:1 < p * (p * N) ¬Nat.Prime (p * (p * N))ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1this:Fact (Nat.Prime p)¬((p * p * N).Coprime (p * N + 1) p * p * N (p * N + 1) ^ (p * p * N - 1) - 1) p:hp:Nat.Prime pN:ha₁:1 < p * (p * N) ¬Nat.Prime (p * (p * N))ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1this:Fact (Nat.Prime p)¬(p.Coprime (p * N + 1) (p * N).Coprime (p * N + 1) p * (p * N) (∑ i Finset.range (p * (p * N) - 1), (p * N + 1) ^ i) * (p * N + 1 - 1)) simpa using (mul_dvd_mul_iff_right fun _ p:hp:Nat.Prime pN:ha₁:1 < p * (p * N) ¬Nat.Prime (p * (p * N))ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1this:Fact (Nat.Prime p)x✝:p * N = 0False All goals completed! 🐙).not.mpr ((ZMod.natCast_eq_zero_iff _ _).not.mp (p:hp:Nat.Prime pN:ha₁:1 < p * (p * N) ¬Nat.Prime (p * (p * N))ha₂: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1ha₂_forall: (b : ), 1 b (p * p * N).Coprime b p * p * N b ^ (p * p * N - 1) - 1this:Fact (Nat.Prime p)¬(∑ i Finset.range (p * (p * N) - 1), (p * N + 1) ^ i) = 0 All goals completed! 🐙))

A composite number a is Carmichael if and only if it is squarefree and, for all prime p dividing a, we have p - 1 ∣ a - 1.

@[category textbook, AMS 11] theorem korselts_criterion (a : ) (ha₁ : a.Composite) : IsCarmichael a Squarefree a p, p.Prime p a (p - 1 : ) (a - 1 : ) := a:ha₁:a.CompositeIsCarmichael a Squarefree a (p : ), Nat.Prime p p a p - 1 a - 1 a:ha₁:a.Compositeh:IsCarmichael ap:hp:Nat.Prime phpa:p ap - 1 a - 1a:ha₁:a.Compositeh:Squarefree a (p : ), Nat.Prime p p a p - 1 a - 1b:hb:b 1hab:a.Coprime ba.FermatPsp b a:ha₁:a.Compositeh:IsCarmichael ap:hp:Nat.Prime phpa:p ap - 1 a - 1 a:ha₁:a.Compositeh:IsCarmichael ap:hp:Nat.Prime phpa:p ah_forall:IsCarmichael a := hp - 1 a - 1 a:ha₁:a.Compositeh:IsCarmichael ap:hp:Nat.Prime phpa:p ah_forall:IsCarmichael a := hthis:Fact (Nat.Prime p) := { out := hp }p - 1 a - 1 a:ha₁:a.Compositeh✝:IsCarmichael ap:hp:Nat.Prime phpa:p ah_forall:IsCarmichael a := hthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh: (x : (ZMod p)ˣ), x Subgroup.zpowers gp - 1 a - 1 p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:(p * k).Compositeh:IsCarmichael (p * k)h_forall:IsCarmichael (p * k)p - 1 p * k - 1 have hk : k.Coprime p := a:ha₁:a.CompositeIsCarmichael a Squarefree a (p : ), Nat.Prime p p a p - 1 a - 1 p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:(p * k).Compositeh:IsCarmichael (p * k)h_forall:IsCarmichael (p * k)hk:¬k.Coprime pFalse p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gw✝:ha₁:(p * (p * w✝)).Compositeh:IsCarmichael (p * (p * w✝))h_forall:IsCarmichael (p * (p * w✝))hk:¬(p * w✝).Coprime pFalse p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gw✝:ha₁:(p * (p * w✝)).Compositeh:IsCarmichael (p * (p * w✝))h_forall:IsCarmichael (p * (p * w✝))hk:¬(p * w✝).Coprime p¬Squarefree (p * (p * w✝)) All goals completed! 🐙 p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:1 < p * k ¬Nat.Prime (p * k)h: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1h_forall: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1hk:k.Coprime pp - 1 p * k - 1 p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:1 < p * k ¬Nat.Prime (p * k)h: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1h_forall: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1hk:k.Coprime pe:ZMod (p * k) ≃+* ZMod p × ZMod k := ZMod.chineseRemainder p - 1 p * k - 1 p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:1 < p * k ¬Nat.Prime (p * k)h: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1h_forall: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1hk:k.Coprime pe:ZMod (p * k) ≃+* ZMod p × ZMod k := ZMod.chineseRemainder s:ZMod (p * k) := e.symm (g, 1)p - 1 p * k - 1 have : NeZero k := fun _ => p:hp:Nat.Prime pthis:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:1 < p * k ¬Nat.Prime (p * k)h: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1h_forall: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1hk:k.Coprime pe:ZMod (p * k) ≃+* ZMod p × ZMod k := ZMod.chineseRemainder s:ZMod (p * k) := e.symm (g, 1)x✝:k = 0False All goals completed! 🐙 have : p * k (e.symm (g, 1)).val ^ (p * k - 1) - 1 := h_forall _ (ZMod.val_pos.2 (p:hp:Nat.Prime pthis✝:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:1 < p * k ¬Nat.Prime (p * k)h: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1h_forall: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1hk:k.Coprime pe:ZMod (p * k) ≃+* ZMod p × ZMod k := ZMod.chineseRemainder s:ZMod (p * k) := e.symm (g, 1)this:NeZero k := { out := fun x => False.elim (Eq.mp (Eq.trans (congr (congrArg And (Eq.trans (congrArg (LT.lt 1) (Eq.trans (congrArg (HMul.hMul p) x) (mul_zero p))) not_lt_one._simp_2)) (congrArg (fun x => ¬Nat.Prime x) (Eq.trans (congrArg (HMul.hMul p) x) (mul_zero p)))) (false_and ¬Nat.Prime 0)) ha₁) }e.symm (g, 1) 0 All goals completed! 🐙)) ((ZMod.isUnit_iff_coprime _ _).1 (p:hp:Nat.Prime pthis✝:Fact (Nat.Prime p) := { out := hp }g:(ZMod p)ˣh✝: (x : (ZMod p)ˣ), x Subgroup.zpowers gk:ha₁:1 < p * k ¬Nat.Prime (p * k)h: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1h_forall: (b : ), 1 b (p * k).Coprime b p * k b ^ (p * k - 1) - 1hk:k.Coprime pe:ZMod (p * k) ≃+* ZMod p × ZMod k := ZMod.chineseRemainder s:ZMod (p * k) := e.symm (g, 1)this:NeZero k := { out := fun x => False.elim (Eq.mp (Eq.trans (congr (congrArg And (Eq.trans (congrArg (LT.lt 1) (Eq.trans (congrArg (HMul.hMul p) x) (mul_zero p))) not_lt_one._simp_2)) (congrArg (fun x => ¬Nat.Prime x) (Eq.trans (congrArg (HMul.hMul p) x) (mul_zero p)))) (false_and ¬Nat.Prime 0)) ha₁) }IsUnit (e.symm (g, 1)).val All goals completed! 🐙)).symm All goals completed! 🐙 a:ha₁:a.Compositeh:Squarefree a (p : ), Nat.Prime p p a p - 1 a - 1b:hb:b 1hab:a.Coprime ba.FermatPsp b a:ha₁:a.Compositeb:hb:b 1hab:a.Coprime bh_sqfr:Squarefree ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1a.FermatPsp b a:b:ha₁:1 < a ¬Nat.Prime ahb:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1a b ^ (a - 1) - 1 a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:a.factorization p (b ^ (a - 1) - 1).factorization p a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime pa.factorization p (b ^ (a - 1) - 1).factorization pa:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:¬Nat.Prime pa.factorization p (b ^ (a - 1) - 1).factorization p a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime pa.factorization p (b ^ (a - 1) - 1).factorization p a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aa.factorization p (b ^ (a - 1) - 1).factorization pa:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:¬p aa.factorization p (b ^ (a - 1) - 1).factorization p a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aa.factorization p (b ^ (a - 1) - 1).factorization p a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wa.factorization p (b ^ (a - 1) - 1).factorization p a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime aa.factorization p (b ^ (a - 1) - 1).factorization p a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime ap ^ a.factorization p b ^ (a - 1) - 1 a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime athis:a.factorization p 1 := not_lt.mp fun h => h_sqfr p hp (sq p Dvd.dvd.trans (pow_dvd_pow p h) (Nat.ordProj_dvd a p))p ^ a.factorization p b ^ (a - 1) - 1 replace : a.factorization p = 1 := this.antisymm (hp.dvd_iff_one_le_factorization (a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime athis:a.factorization p 1 := not_lt.mp fun h => h_sqfr p hp (sq p Dvd.dvd.trans (pow_dvd_pow p h) (Nat.ordProj_dvd a p))a 0 All goals completed! 🐙) |>.1 hpa) simp_rw a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime athis:a.factorization p = 1 := LE.le.antisymm _fvar.824206 ((Nat.Prime.dvd_iff_one_le_factorization hp (korselts_criterion._proof_10 a ha₁)).mp hpa)p ^ a.factorization p b ^ (a - 1) - 1this, pow_one, CharP.cast_eq_zero_iff (ZMod p)] have one_le_b_pow : 1 b ^ (a - 1) := a:ha₁:a.CompositeIsCarmichael a Squarefree a (p : ), Nat.Prime p p a p - 1 a - 1 All goals completed! 🐙 a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime athis:a.factorization p = 1 := LE.le.antisymm _fvar.824206 ((Nat.Prime.dvd_iff_one_le_factorization hp (korselts_criterion._proof_10 a ha₁)).mp hpa)one_le_b_pow:1 b ^ (a - 1) := Decidable.byContradiction fun a_1 => korselts_criterion._proof_11 a b hb p w ha₁ a_1b ^ (a - 1) - 1 = 0 simp_rw a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime athis:a.factorization p = 1 := LE.le.antisymm _fvar.824206 ((Nat.Prime.dvd_iff_one_le_factorization hp (korselts_criterion._proof_10 a ha₁)).mp hpa)one_le_b_pow:1 b ^ (a - 1) := Decidable.byContradiction fun a_1 => korselts_criterion._proof_11 a b hb p w ha₁ a_1b ^ (a - 1) - 1 = 0h, pow_mul] simp_all +decide [CharP.cast_eq_zero_iff _ p, hp.coprime_iff_not_dvd.1 (hab.of_dvd_left (a:b:hb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:p aw:h:a - 1 = (p - 1) * wha₁:1 < aha₂:¬Nat.Prime athis:a.factorization p = 1 := LE.le.antisymm _fvar.824206 ((Nat.Prime.dvd_iff_one_le_factorization hp (korselts_criterion._proof_10 a ha₁)).mp hpa)one_le_b_pow:1 b ^ (a - 1) := Decidable.byContradiction fun a_1 => korselts_criterion._proof_11 a b hb p w ha₁ a_1p a All goals completed! 🐙)), ZMod.pow_card_sub_one_eq_one] a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:Nat.Prime phpa:¬p aa.factorization p (b ^ (a - 1) - 1).factorization p All goals completed! 🐙 a:b:ha₁:1 < a ¬Nat.Prime ahb✝:1 bhab:a.Coprime bh_sqfr: (x : ), Nat.Prime x ¬x * x ah_dvd: (p : ), Nat.Prime p p a p - 1 a - 1hb:¬b ^ (a - 1) - 1 = 0p:hp:¬Nat.Prime pa.factorization p (b ^ (a - 1) - 1).factorization p All goals completed! 🐙 @[category test, AMS 11] lemma isCarmichael_561 : IsCarmichael 561 := IsCarmichael 561 have h_comp : Nat.Composite 561 := IsCarmichael 561 1 < 561 ¬Nat.Prime 561 1 < 561¬Nat.Prime 561 1 < 561¬Nat.Prime 561 All goals completed! 🐙 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))Squarefree 561 (p : ), Nat.Prime p p 561 p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))Squarefree 561h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false)) (p : ), Nat.Prime p p 561 p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))Squarefree 561 have h1 : 561 = 3 * 11 * 17 := IsCarmichael 561 All goals completed! 🐙 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * 11 * 17 := Mathlib.Meta.NormNum.isNat_eq_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 3)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 11)) (Eq.refl 33)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 17)) (Eq.refl 561))(Squarefree 3 Squarefree 11) Squarefree 17 refine (Nat.prime_iff.mp (h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * 11 * 17 := Mathlib.Meta.NormNum.isNat_eq_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 3)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 11)) (Eq.refl 33)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 17)) (Eq.refl 561))Nat.Prime 3 All goals completed! 🐙 : Nat.Prime 3)).squarefree, (Nat.prime_iff.mp (h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * 11 * 17 := Mathlib.Meta.NormNum.isNat_eq_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 3)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 11)) (Eq.refl 33)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 17)) (Eq.refl 561))Nat.Prime 11 All goals completed! 🐙 : Nat.Prime 11)).squarefree, (Nat.prime_iff.mp (h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * 11 * 17 := Mathlib.Meta.NormNum.isNat_eq_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_mul (Eq.refl HMul.hMul) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 3)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 11)) (Eq.refl 33)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 17)) (Eq.refl 561))Nat.Prime 17 All goals completed! 🐙 : Nat.Prime 17)).squarefree h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false)) (p : ), Nat.Prime p p 561 p - 1 561 - 1 intro p h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime pp 561 p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 561p - 1 561 - 1 have h1 : 561 = 3 * (11 * 17) := IsCarmichael 561 All goals completed! 🐙 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h3:p 3p - 1 561 - 1h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h3:p 3p - 1 561 - 1 have : p = 3 := ((h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h3:p 3Nat.Prime 3 All goals completed! 🐙 : Nat.Prime 3).eq_one_or_self_of_dvd p h3).resolve_left hp.ne_one h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * (11 * 17)hp:Nat.Prime 3hp_dvd:3 3 * (11 * 17)h3:3 33 - 1 561 - 1; All goals completed! 🐙 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17h11:p 11p - 1 561 - 1h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17h17:p 17p - 1 561 - 1 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17h11:p 11p - 1 561 - 1 have : p = 11 := ((h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17h11:p 11Nat.Prime 11 All goals completed! 🐙 : Nat.Prime 11).eq_one_or_self_of_dvd p h11).resolve_left hp.ne_one h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * (11 * 17)hp:Nat.Prime 11hp_dvd:11 3 * (11 * 17)h11_17:11 11 * 17h11:11 1111 - 1 561 - 1; All goals completed! 🐙 h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17h17:p 17p - 1 561 - 1 have : p = 17 := ((h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))p:hp:Nat.Prime php_dvd:p 3 * (11 * 17)h1:561 = 3 * (11 * 17)h11_17:p 11 * 17h17:p 17Nat.Prime 17 All goals completed! 🐙 : Nat.Prime 17).eq_one_or_self_of_dvd p h17).resolve_left hp.ne_one h_comp:Nat.Composite 561 := id Mathlib.Meta.NormNum.isNat_lt_true (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 1)) (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Eq.refl false), Mathlib.Meta.NormNum.isNat_not_prime (Mathlib.Meta.NormNum.isNat_ofNat (Eq.refl 561)) (Mathlib.Meta.NormNum.not_prime_mul_of_ble 3 187 561 (Eq.refl 561) (Eq.refl false) (Eq.refl false))h1:561 = 3 * (11 * 17)hp:Nat.Prime 17hp_dvd:17 3 * (11 * 17)h11_17:17 11 * 17h17:17 1717 - 1 561 - 1; All goals completed! 🐙

Giuga showed that a number n is strong Giuga if and only if it is Carmichael and ∑_{p|n} 1/p - 1/n ∈ ℕ (i.e., if and only if it is Carmichael and weak Giuga). Ref: G. Giuga, Su una presumibile proprieta caratteristica dei numeri primi

@[category research solved, AMS 11] theorem declaration uses 'sorry'isStrongGiuga_iff {a : } (ha : a.Composite) : IsStrongGiuga a IsCarmichael a n : , p a.primeFactors, (1 / p : ) - 1 / a = n := a:ha:a.CompositeIsStrongGiuga a IsCarmichael a n, p a.primeFactors, 1 / p - 1 / a = n All goals completed! 🐙

Every strong Giuga number is a Carmichael number.

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants.isStrongGiuga_implies_isCarmichael (a : ) (ha : IsStrongGiuga a) : IsCarmichael a := a:ha:IsStrongGiuga aIsCarmichael a All goals completed! 🐙

Giuga showed that a Giuga number has at least 9 prime factors. Ref: G. Giuga, Su una presumibile proprieta caratteristica dei numeri primi

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants.le_primeFactors_card_of_isStrongGiuga (a : ) (ha : IsStrongGiuga a) : 9 a.primeFactors.card := a:ha:IsStrongGiuga a9 a.primeFactors.card All goals completed! 🐙

Giuga showed that a counterexample Giuga number has at least 1000 digits. Ref: G. Giuga, Su una presumibile proprieta caratteristica dei numeri primi

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants._1000_le_digits_length_of_isStrongGiuga (a : ) (ha : IsStrongGiuga a) : 1000 (Nat.digits 10 a).length := a:ha:IsStrongGiuga a1000 (Nat.digits 10 a).length All goals completed! 🐙

Bedocchi showed that any Giuga number has at least 1700 digits. Ref: E. Bedocchi, Note on a conjecture about prime numbers

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants._1700_le_digits_length_of_isStrongGiuga (a : ) (ha : IsStrongGiuga a) : (Nat.digits 10 a).length > 1700 := a:ha:IsStrongGiuga a(Nat.digits 10 a).length > 1700 All goals completed! 🐙

Borwein, Borwein, Borwein and Girgensohn showed that any strong Giuga number has at least 13000 digits. Ref: D. Borwein, J. M. Borwein, P. B. Borwein, and R. Girgensohn, Giuga’s conjecture on primality

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants._13000_le_digits_length_of_isStrongGiuga (a : ) (ha : IsStrongGiuga a) : 13000 (Nat.digits 10 a).length := a:ha:IsStrongGiuga a13000 (Nat.digits 10 a).length All goals completed! 🐙 open Classical in

Let G(X) denote the number of exceptions n ≤ X to Giuga’s conjecture. Then for X larger than an absolute constant which can be made explicit, G(X) ≪ X^{1/2} log X. Ref: Vicentiu Tipu, A Note on Giuga’s Conjecture

@[category research solved, AMS 11] theorem declaration uses 'sorry'agoh_giuga.variants.isStrongGiuga_growth (G : ) (hG : G = fun x => Finset.Icc 1 x |>.filter IsStrongGiuga |>.card) : N O, n N, G n O * (n : ).sqrt * (n : ).log := G: hG:G = fun x => (Finset.filter IsStrongGiuga (Finset.Icc 1 x)).card N O, n N, (G n) O * n * Real.log n All goals completed! 🐙 end AgohGiuga