Compfiles: Catalog Of Math Problems Formalized In Lean

Usa2005P1

module

public import Mathlib.Algebra.Order.Ring.Star
public import Mathlib.Data.Finset.NatDivisors
public import Mathlib.Data.Finset.Sort
public import Mathlib.Data.Int.ConditionallyCompleteOrder
public import Mathlib.Data.Int.Star
public import Mathlib.Data.Nat.Factorization.Basic
public import Mathlib.Tactic.Linarith
public import Mathlib.Tactic.NormNum.Ineq
public import Mathlib.Tactic.Ring
public import Mathlib.Tactic.Zify

public section


/-!
# USA Mathematical Olympiad 2005, Problem 1

Determine all composite positive integers n for which it is possible to arrange
all divisors of n that are greater than 1 in a circle so that no two adjacent
divisors are relatively prime.
-/

namespace Usa2005P1

/-- The adjacency condition required of neighboring divisors in the circle:
they must not be relatively prime. -/
def R (a b : ℕ) : Prop := ¬ Nat.Coprime a b

/-- `GoodCircle n` says that all divisors of `n` that are greater than `1`
can be arranged in a circle so that no two adjacent divisors are relatively
prime.  The circle is represented by a list `l` containing each such divisor
exactly once; adjacency means "consecutive in `l`" (via `l.IsChain R`) plus the
wrap-around pair (`l.getLast?` with `l.head?`). -/
def GoodCircle (n : ℕ) : Prop :=
  ∃ l : List ℕ, l.Nodup ∧ l ≠ [] ∧
    (∀ d : ℕ, d ∈ l ↔ d ∣ n ∧ 1 < d) ∧
    l.IsChain R ∧
    ∀ a ∈ l.getLast?, ∀ b ∈ l.head?, R a b

/-- The answer: all composite positive integers other than products of two
distinct primes. -/
/- determine -/ abbrev SolutionSet : Set ℕ := sorry

/-- USA Mathematical Olympiad 2005, Problem 1:
the composite positive integers whose divisors greater than `1` can be arranged
in a circle with no two adjacent divisors relatively prime are exactly the
composite numbers that are not products of two distinct primes. -/
theorem usa2005_p1 (n : ℕ) (hn : 1 < n) (hnp : ¬ n.Prime) :
    GoodCircle n ↔ n ∈ SolutionSet := sorry

end Usa2005P1

File author(s): Kimi K3

This problem has a complete formalized solution.

Open with the in-brower editor at live.lean-lang.org:
External resources: