{
  "id": "6652",
  "ident": "NS.06652",
  "slug": "oeis-56777",
  "title": "Divisibility of $2^n + 1$ by $n$",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "All members of the sequence A56777 come from prime quadruples.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA56777.comesFromPrimeQuadruple_of_a",
  "statement_lean": "theorem comesFromPrimeQuadruple_of_a {n : ℕ} (h : A n) : ComesFromPrimeQuadruple n",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Divisibility of $2^n + 1$ by $n$\n\nA56777 lists composite numbers $n$ satisfying both $\\varphi(n+12) = \\varphi(n) + 12$ and\n$\\sigma(n+12) = \\sigma(n) + 12$.\n\nThe conjectures state identities connecting A56777 and prime quadruples (A7530), as\nwell as congruences satisfied by the members of A56777.\n\n*References:*\n- [A56777](https://oeis.org/A56777)\n-/\n\n@[expose] public section\n\nnamespace OeisA56777\n\nopen Nat\nopen scoped ArithmeticFunction.sigma\n\n/-- A composite number $n$ is in the sequence A56777 if it satisfies both\n$\\varphi(n+12) = \\varphi(n) + 12$ and $\\sigma(n+12) = \\sigma(n) + 12$. -/\ndef A (n : ℕ) : Prop :=\n  ¬n.Prime ∧ 1 < n ∧ totient (n + 12) = totient n + 12 ∧ σ 1 (n + 12) = σ 1 n + 12\n\n/-- A number $n$ comes from a prime quadruple $(p, p+2, p+6, p+8)$ if\n$n = p(p+8)$ for some prime $p$ where $p$, $p+2$, $p+6$, $p+8$ are all prime. -/\ndef ComesFromPrimeQuadruple (n : ℕ) : Prop :=\n  ∃ p : ℕ, p.Prime ∧ (p + 2).Prime ∧ (p + 6).Prime ∧ (p + 8).Prime ∧ n = p * (p + 8)\n\n/-- $65$ is in the sequence A56777. -/\n@[category test, AMS 11]\ntheorem a_65 : A 65 := by\n  refine ⟨?_, by norm_num, ?_, ?_⟩\n  · simp only [show (65 : ℕ) = 5 * 13 by norm_num]\n    exact not_prime_mul (by norm_num) (by norm_num)\n  · decide\n  · decide\n\n/-- $209$ is in the sequence A56777. -/\n@[category test, AMS 11]\ntheorem a_209 : A 209 := by\n  unfold A\n  simp only [one_lt_ofNat, reduceAdd, true_and]\n  refine ⟨?_, ?_, ?_⟩\n  · norm_num\n  · have eq1 : 221 = 13 * 17 := by norm_num\n    have eq2 : 209 = 11 * 19 := by norm_num\n    rw [eq1, eq2, totient_mul (by norm_num), totient_mul (by norm_num),\n      totient_prime (by norm_num), totient_prime (by norm_num), totient_prime (by norm_num),\n      totient_prime (by norm_num)]\n  · decide\n\n/-- Numbers coming from prime quadruples are in the sequence A56777. -/\n@[category textbook, AMS 11]\ntheorem a_of_comesFromPrimeQuadruple {n : ℕ} (h : ComesFromPrimeQuadruple n) : A n := by\n  obtain ⟨p, hp, hp2, hp6, hp8, rfl⟩ := h\n  -- n + 12 = p * (p+8) + 12 = (p+2) * (p+6)\n  have hsum : p * (p + 8) + 12 = (p + 2) * (p + 6) := by ring\n  -- coprimality facts between the four primes\n  have hne_p_p8 : p ≠ p + 8 := by omega\n  have hne_p2_p6 : p + 2 ≠ p + 6 := by omega\n  have hcop1 : Nat.Coprime p (p + 8) := (Nat.coprime_primes hp hp8).mpr hne_p_p8\n  have hcop2 : Nat.Coprime (p + 2) (p + 6) := (Nat.coprime_primes hp2 hp6).mpr hne_p2_p6\n  refine ⟨?_, ?_, ?_, ?_⟩\n  -- ¬ Prime (p * (p+8))\n  · exact Nat.not_prime_mul hp.one_lt.ne' (by have := hp8.one_lt; omega)\n  -- 1 < p * (p+8)\n  · have h1 : 2 ≤ p := hp.two_le\n    have h2 : 10 ≤ p + 8 := by omega\n    nlinarith\n  -- totient: φ((p+2)(p+6)) = φ(p(p+8)) + 12\n  · rw [hsum, Nat.totient_mul hcop2, Nat.totient_mul hcop1,\n        Nat.totient_prime hp, Nat.totient_prime hp2,\n        Nat.totient_prime hp6, Nat.totient_prime hp8]\n    zify [show 1 ≤ p from hp.one_lt.le, show 1 ≤ p + 2 by omega,\n          show 1 ≤ p + 6 by omega, show 1 ≤ p + 8 by omega]\n    ring\n  -- sigma: σ₁((p+2)(p+6)) = σ₁(p(p+8)) + 12\n  · rw [hsum, ArithmeticFunction.isMultiplicative_sigma.map_mul_of_coprime hcop2,\n        ArithmeticFunction.isMultiplicative_sigma.map_mul_of_coprime hcop1]\n    have e1 : ArithmeticFunction.sigma 1 p = p + 1 := by\n      have := ArithmeticFunction.sigma_one_apply_prime_pow (p := p) (i := 1) hp\n      simpa using this\n    have e2 : ArithmeticFunction.sigma 1 (p + 2) = (p + 2) + 1 := by\n      have := ArithmeticFunction.sigma_one_apply_prime_pow (p := p + 2) (i := 1) hp2\n      simpa using this\n    have e6 : ArithmeticFunction.sigma 1 (p + 6) = (p + 6) + 1 := by\n      have := ArithmeticFunction.sigma_one_apply_prime_pow (p := p + 6) (i := 1) hp6\n      simpa using this\n    have e8 : ArithmeticFunction.sigma 1 (p + 8) = (p + 8) + 1 := by\n      have := ArithmeticFunction.sigma_one_apply_prime_pow (p := p + 8) (i := 1) hp8\n      simpa using this\n    rw [e1, e2, e6, e8]\n    ring\n\n/-- $11009$ is in the sequence A56777. -/\n@[category test, AMS 11]\ntheorem a_11009 : A 11009 := by\n  apply a_of_comesFromPrimeQuadruple\n  exact ⟨101, by decide, by decide, by decide, by decide, by rfl⟩\n\n/-- All members of the sequence A56777 come from prime quadruples. -/\n@[category research open, AMS 11]\ntheorem comesFromPrimeQuadruple_of_a {n : ℕ} (h : A n) : ComesFromPrimeQuadruple n := by\n  sorry\n\n/-- Numbers coming from prime quadruples satisfy $n \\equiv 65 \\pmod{72}$. -/\n@[category textbook, AMS 11]\ntheorem mod_72_of_comesFromPrimeQuadruple {n : ℕ} (h : ComesFromPrimeQuadruple n) :\n    n % 72 = 65 := by\n  obtain ⟨p, hp, hp2, hp6, hp8, rfl⟩ := h\n  have hp5 : 5 ≤ p := by\n    by_contra! hlt\n    interval_cases p <;> simp_all (config := { decide := true })\n  have h2 : ¬ (2 ∣ p) := by\n    intro hdvd; cases hp.eq_one_or_self_of_dvd 2 hdvd with | inl h => omega | inr h => omega\n  have h3 : ¬ (3 ∣ p) := by\n    intro hdvd; cases hp.eq_one_or_self_of_dvd 3 hdvd with | inl h => omega | inr h => omega\n  have hmod2 : p % 2 = 1 := by omega\n  have hmod3 : p % 3 = 2 := by\n    have hne1 : p % 3 ≠ 1 := by\n      intro heq\n      have h3dvd : 3 ∣ (p + 2) := ⟨p / 3 + 1, by omega⟩\n      cases hp2.eq_one_or_self_of_dvd 3 h3dvd with | inl h => omega | inr h => omega\n    omega\n  have hmod6 : p % 6 = 5 := by omega\n  set q := p / 6\n  have hp_eq : p = 6 * q + 5 := by omega\n  have hparity : 2 ∣ q * (q + 3) := by\n    rcases Nat.even_or_odd q with ⟨r, hr⟩ | ⟨r, hr⟩\n    · exact dvd_mul_of_dvd_left ⟨r, by omega⟩ _\n    · exact dvd_mul_of_dvd_right ⟨r + 2, by omega⟩ _\n  obtain ⟨k, hk⟩ := hparity\n  have h1 : p * (p + 8) = (6 * q + 5) * (6 * q + 13) := by congr 1; omega\n  have h2 : (6 * q + 5) * (6 * q + 13) = 36 * (q * (q + 3)) + 65 := by ring\n  have h3 : 36 * (q * (q + 3)) = 72 * k := by linarith\n  have hprod : p * (p + 8) = 72 * k + 65 := by linarith\n  omega\n\n/-- Numbers coming from prime quadruples satisfy $n \\equiv 9 \\pmod{100}$,\nexcept the first value \"65\". -/\n@[category textbook, AMS 11]\ntheorem mod_100_of_comesFromPrimeQuadruple {n : ℕ} (h65 : 65 < n) (h : ComesFromPrimeQuadruple n) :\n    n % 100 = 9 := by\n  obtain ⟨p, hp, hp2, hp6, hp8, rfl⟩ := h\n  have hp5 : 5 ≤ p := by\n    by_contra hlt; push Not at hlt\n    interval_cases p <;> simp_all (config := { decide := true })\n  have h2 : ¬ (2 ∣ p) := by\n    intro hdvd; cases hp.eq_one_or_self_of_dvd 2 hdvd with | inl h => omega | inr h => omega\n  have h3 : ¬ (3 ∣ p) := by\n    intro hdvd; cases hp.eq_one_or_self_of_dvd 3 hdvd with | inl h => omega | inr h => omega\n  have h5 : ¬ (5 ∣ p) := by\n    intro hdvd; cases hp.eq_one_or_self_of_dvd 5 hdvd with | inl h => omega | inr h =>\n      -- p = 5 → p*(p+8) = 65, but 65 < n = p*(p+8) is impossible\n      subst h; omega\n  have hmod30 : p % 30 = 11 := by\n    have hmod2 : p % 2 = 1 := by omega\n    have hmod3 : p % 3 = 2 := by\n      have : p % 3 ≠ 1 := by\n        intro heq; have : 3 ∣ (p + 2) := ⟨p / 3 + 1, by omega⟩\n        cases hp2.eq_one_or_self_of_dvd 3 this with | inl h => omega | inr h => omega\n      omega\n    have hmod5 : p % 5 = 1 := by\n      have hne2 : p % 5 ≠ 2 := by\n        intro heq; have : 5 ∣ (p + 8) := ⟨p / 5 + 2, by omega⟩\n        cases hp8.eq_one_or_self_of_dvd 5 this with | inl h => omega | inr h => omega\n      have hne3 : p % 5 ≠ 3 := by\n        intro heq; have : 5 ∣ (p + 2) := ⟨p / 5 + 1, by omega⟩\n        cases hp2.eq_one_or_self_of_dvd 5 this with | inl h => omega | inr h => omega\n      have hne4 : p % 5 ≠ 4 := by\n        intro heq; have : 5 ∣ (p + 6) := ⟨p / 5 + 2, by omega⟩\n        cases hp6.eq_one_or_self_of_dvd 5 this with | inl h => omega | inr h => omega\n      omega\n    omega\n  set q := p / 30\n  have hp_eq : p = 30 * q + 11 := by omega\n  -- p*(p+8) = (30q+11)(30q+19) = 900*q*(q+1) + 30*(11+19)*q + 209\n  -- = 900*q*(q+1) + 900*q + 209 ... let me just compute with ring\n  have hparity : 2 ∣ q * (q + 1) := by\n    rcases Nat.even_or_odd q with ⟨r, hr⟩ | ⟨r, hr⟩\n    · exact dvd_mul_of_dvd_left ⟨r, by omega⟩ _\n    · exact dvd_mul_of_dvd_right ⟨r + 1, by omega⟩ _\n  obtain ⟨k, hk⟩ := hparity\n  have h1 : p * (p + 8) = (30 * q + 11) * (30 * q + 19) := by congr 1; omega\n  have h2 : (30 * q + 11) * (30 * q + 19) = 900 * (q * (q + 1)) + 209 := by ring\n  have h3 : 900 * (q * (q + 1)) = 1800 * k := by linarith\n  have hprod : p * (p + 8) = 1800 * k + 209 := by linarith\n  omega\n\nend OeisA56777\n",
  "statement_hash": "dbeba15a764a75db57cfaca5cd07f47d18dc38c70d0a68d6085f628555dc3277",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}