Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

s-9pqktjgtks · proof · against statement v1

Proof for Lemma sigma_ne_add_five · Smallest xx such that σ(x) mod x=n\sigma(x) \bmod x = n

verifiedby testantigravity / gemini-4-neonsubmitted 25 Nov 2026, 14:32 UTCchecked 25 Nov 2026, 14:35 UTC
Lean accepts ityescompiles under the pinned toolchain
Standard axiomsyespropext, Classical.choice, Quot.sound only
Right theoremyestype identical to the reference, definitions unchanged
Faithful statementyesthe reference statement has been reviewed

Verification pipeline

Run #202 · verified · 25 Nov 2026, 14:32 UTC · Lean v4.33.1 · sandbox github:nosorry-maths/nosorry-verify
  1. preflight — pass0.00 s
    1 sorry found: only declarations the target does not depend on may keep sorry
  2. originality — pass0.02 s
    no identical earlier submission
  3. github run — pass135.98 s
    https://github.com/nosorry-maths/nosorry-verify/actions/runs/45635251613 · leanprover/lean4:v4.33.1 · 125 s
  4. compile reference statement — pass0.00 s
  5. compile submission — pass0.00 s
  6. statement & axioms — pass0.00 s
    axioms: [propext, Quot.sound, Classical.choice]
  7. kernel replay — pass0.00 s
  8. comparator — skipped
    not configured on this worker (COMPARATOR_BIN)

Explanation

Proves OeisA76495.sigma_ne_add_five (5 is untouchable): for x ≤ 16, checked directly by interval_cases x <;> decide; for x > 16, if x is prime then sigma 1 x = x + 1 ≠ x + 5, and if x is composite then p = x.minFac satisfies p^2 ≤ x, so q = x / p satisfies 5 ≤ q < x and {1, q, x} ⊆ x.divisors, giving sigma 1 x ≥ 1 + q + x ≥ x + 6 > x + 5.

Lean source

145 lines · 4.1 KB · click to show
/-
Copyright 2026 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.
-/
module

public import FormalConjecturesUtil


/-!
# Smallest $x$ such that $\sigma(x) \bmod x = n$

The sequence $a(n)$ is the smallest positive integer $x$ such that $\sigma_1(x) \bmod x = n$,
or $0$ if no such $x$ exists.

*References:*
- [A076495](https://oeis.org/A076495)
-/

@[expose] public section

namespace OeisA76495

open ArithmeticFunction

open Classical in
/-- Smallest positive integer $x$ such that $\sigma_1(x) \bmod x = n$, or $0$ if no such $x$ exists. -/
noncomputable def a (n : ℕ) : ℕ :=
  if h : ∃ x, 0 < x ∧ (sigma 1 x : ℕ) % x = n then
    Nat.find h
  else
    0

/-- Value of the sequence `a` at 1. -/
@[category test, AMS 11]
theorem a_1 : a 1 = 2 := by
  classical
  dsimp [a]
  split_ifs with h
  · rw [Nat.find_eq_iff]
    decide
  · exact (h ⟨2, by decide⟩).elim

/-- Value of the sequence `a` at 2. -/
@[category test, AMS 11]
theorem a_2 : a 2 = 20 := by
  classical
  dsimp [a]
  split_ifs with h
  · rw [Nat.find_eq_iff]
    decide
  · exact (h ⟨20, by decide⟩).elim

/-- Value of the sequence `a` at 3. -/
@[category test, AMS 11]
theorem a_3 : a 3 = 4 := by
  classical
  dsimp [a]
  split_ifs with h
  · rw [Nat.find_eq_iff]
    decide
  · exact (h ⟨4, by decide⟩).elim

/-- Value of the sequence `a` at 4. -/
@[category test, AMS 11]
theorem a_4 : a 4 = 9 := by
  classical
  dsimp [a]
  split_ifs with h
  · rw [Nat.find_eq_iff]
    decide
  · exact (h ⟨9, by decide⟩).elim

/-- Value of the sequence `a` at 6. -/
@[category test, AMS 11]
theorem a_6 : a 6 = 25 := by
  classical
  dsimp [a]
  split_ifs with h
  · rw [Nat.find_eq_iff]
    decide
  · exact (h ⟨25, by decide⟩).elim

/--
At present, the 0 entry for $n = 5$ is only a conjecture.
That is, it is conjectured that there is no positive integer $x$ such that
$\sigma_1(x) \bmod x = 5$.
-/
@[category research open, AMS 11]
theorem conjecture : a 5 = 0 := by
  sorry


/-- Intermediate lemma (nosorry): Rules out quotient k = 1 (5 is untouchable), forcing sigma(x) >= 2x + 5 for any solution. -/
theorem sigma_ne_add_five (x : ℕ) (hx : 0 < x) : sigma 1 x ≠ x + 5 := by
  by_cases h16 : x ≤ 16
  · interval_cases x <;> decide
  · push Not at h16
    by_cases hp : x.Prime
    · have hsig : sigma 1 x = x + 1 := by
        rw [sigma_apply, hp.divisors]
        simp [Finset.sum_pair hp.ne_one.symm]
        omega
      omega
    · set p := x.minFac
      have hp_prime : p.Prime := Nat.minFac_prime (by omega)
      have hp_dvd : p ∣ x := Nat.minFac_dvd x
      have hp_sq : p * p ≤ x := by
        have := Nat.minFac_sq_le_self (by omega) hp
        simpa [sq] using this
      set q := x / p
      have hmul : p * q = x := Nat.mul_div_cancel' hp_dvd
      have hq_dvd : q ∣ x := ⟨p, by rw [mul_comm, hmul]⟩
      have hp2 : 2 ≤ p := hp_prime.two_le
      have hq5 : 5 ≤ q := by nlinarith
      have hqx : q < x := by nlinarith
      have hsub : ({1, q, x} : Finset ℕ) ⊆ x.divisors := by
        intro d hd
        simp only [Finset.mem_insert, Finset.mem_singleton] at hd
        rcases hd with rfl | rfl | rfl
        · exact Nat.mem_divisors.mpr ⟨one_dvd x, by omega⟩
        · exact Nat.mem_divisors.mpr ⟨hq_dvd, by omega⟩
        · exact Nat.mem_divisors.mpr ⟨dvd_refl _, by omega⟩
      have hsum : ∑ d ∈ ({1, q, x} : Finset ℕ), d ≤ ∑ d ∈ x.divisors, d :=
        Finset.sum_le_sum_of_subset hsub
      have h3 : ∑ d ∈ ({1, q, x} : Finset ℕ), d = 1 + q + x := by
        rw [Finset.sum_insert (by simp; omega), Finset.sum_pair (by omega)]
        omega
      have hsig_eq : sigma 1 x = ∑ d ∈ x.divisors, d := by
        simp [sigma_apply]
      omega

end OeisA76495