{
  "id": "582",
  "ident": "NS.00582",
  "slug": "erdos-1074",
  "title": "Erdős Problem 1074",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Let $S$ be the set of all $m\\geq 1$ such that there exists a prime $p\\not\\equiv 1\\pmod{m}$ such\nthat $m! + 1 \\equiv 0\\pmod{p}$. Does\n$$\n  \\lim\\frac{|S\\cap[1, x]|}{x}\n$$\nexist?",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [
    "question"
  ],
  "collection": "erdos",
  "source_url": "https://www.erdosproblems.com/1074",
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "Erdos1074.erdos_1074.parts.i",
  "statement_lean": "theorem erdos_1074.parts.i : ∃ c, EHSNumbers.HasDensity c",
  "challenge_source": "/-\nCopyright 2025 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# Erdős Problem 1074\n\n*Reference:* [erdosproblems.com/1074](https://www.erdosproblems.com/1074)\n-/\n\n@[expose] public section\n\nnamespace Erdos1074\n\nopen scoped Nat\nopen Nat\n\n/-- The EHS numbers (after Erdős, Hardy, and Subbarao) are those $m\\geq 1$ such that there\nexists a prime $p\\not\\equiv 1\\pmod{m}$ such that $m! + 1 \\equiv 0\\pmod{p}$. -/\nabbrev EHSNumbers : Set ℕ := {m | 1 ≤ m ∧ ∃ p, p.Prime ∧ ¬p ≡ 1 [MOD m] ∧ p ∣ m ! + 1}\n\n/-- The Pillai primes are those primes $p$ such that there exists an $m \\ge 1$ with\n$p\\not\\equiv 1\\pmod{m}$ such that $m! + 1 \\equiv 0\\pmod{p}$-/\nabbrev PillaiPrimes : Set ℕ := {p | p.Prime ∧ ∃ m ≥ 1, ¬p ≡ 1 [MOD m] ∧ p ∣ m ! + 1}\n\n@[category test, AMS 11]\ntheorem two_not_mem_pillaiPrimes : ¬ 2 ∈ PillaiPrimes := by\n  norm_num\n  intro m hm h\n  exact (Nat.dvd_factorial (by decide) (hm.lt_of_ne (by bound))).modEq_zero_nat.add_right 1\n\n@[category test, AMS 11]\ntheorem twentyThree_mem_pillaiPrimes : 23 ∈ PillaiPrimes := by\n  norm_num\n  use 14\n  decide\n\n/-- Let $S$ be the set of all $m\\geq 1$ such that there exists a prime $p\\not\\equiv 1\\pmod{m}$ such\nthat $m! + 1 \\equiv 0\\pmod{p}$. Does\n$$\n  \\lim\\frac{|S\\cap[1, x]|}{x}\n$$\nexist? -/\n@[category research open, question, AMS 11]\ntheorem erdos_1074.parts.i : ∃ c, EHSNumbers.HasDensity c := by\n  sorry\n\ndef erdos_1074.parts.ii.answer : ℝ := sorry\n\n/-- Let $S$ be the set of all $m\\geq 1$ such that there exists a prime $p\\not\\equiv 1\\pmod{m}$ such\nthat $m! + 1 \\equiv 0\\pmod{p}$. What is\n$$\n  \\lim\\frac{|S\\cap[1, x]|}{x}?\n$$ -/\n@[category research open, question value, AMS 11]\ntheorem erdos_1074.parts.ii : EHSNumbers.HasDensity erdos_1074.parts.ii.answer := by\n  sorry\n\n/-- Similarly, if $P$ is the set of all primes $p$ such that there exists an $m$ with\n$p\\not\\equiv 1\\pmod{m}$ such that $m! + 1 \\equiv 0\\pmod{p}$, then does\n$$\n  \\lim\\frac{|P\\cap[1, x]|}{\\pi(x)}\n$$\nexist? -/\n@[category research open, question, AMS 11]\ntheorem erdos_1074.parts.iii : ∃ c, PillaiPrimes.HasDensity c {p | p.Prime} := by\n  sorry\n\ndef erdos_1074.parts.iv.answer : ℝ := sorry\n\n/-- Similarly, if $P$ is the set of all primes $p$ such that there exists an $m$ with\n$p\\not\\equiv 1\\pmod{m}$ such that $m! + 1 \\equiv 0\\pmod{p}$, then what is\n$$\n  \\lim\\frac{|P\\cap[1, x]|}{\\pi(x)}?\n$$ -/\n@[category research open, question value, AMS 11]\ntheorem erdos_1074.parts.iv :\n    PillaiPrimes.HasDensity erdos_1074.parts.iv.answer {p | p.Prime} := by\n  sorry\n\n/-- Pillai [Pi30] raised the question of whether there exist any primes in $P$. This was answered\nby Chowla, who noted that, for example, $14! + 1 \\equiv 18! + 1 \\equiv 0 \\pmod{23}$. -/\n@[category test, AMS 11]\ntheorem erdos_1074.variants.mem_pillaiPrimes : 23 ∈ PillaiPrimes := by\n  norm_num\n  exact ⟨14, by decide⟩\n\nset_option linter.style.formal_proof_palomar false in\n/--\nErdős, Hardy, and Subbarao proved that $S$ is infinite.\n\nFormal proof linked here provided by AlphaProof.\n-/\n@[category research solved, AMS 11, formal_proof using formal_conjectures at\n\"https://github.com/mzhorvath1/formal-conjectures/blob/3dec597bd1a73778760b761712a1fc5fb24bc5d7/FormalConjectures/ErdosProblems/1074.lean#L99\"]\ntheorem erdos_1074.variants.EHSNumbers_infinite : EHSNumbers.Infinite := by\n  sorry\n\nset_option linter.style.formal_proof_palomar false in\n/-- Erdős, Hardy, and Subbarao proved that $P$ is infinite. -/\n@[category research solved, AMS 11, formal_proof using lean4 at \"https://github.com/anatoliiohorodnyk/lean-fc-proofs/blob/5da9642575b26c2c816a49bcb56b33fed5456619/Proofs/T_Erdos1074_erdos_1074_variants_PillaiPrimes_infinite.lean#L178\"]\ntheorem erdos_1074.variants.PillaiPrimes_infinite : PillaiPrimes.Infinite := by\n  sorry\n\n/-- The sequence $S$ begins $8, 9, 13, 14, 15, 16, 17, ...$ -/\n@[category test, AMS 11]\ntheorem erdos_1074.variants.EHSNumbers_init :\n    nth EHSNumbers '' (Set.Icc 0 6) = {8, 9, 13, 14, 15, 16, 17} := by\n  sorry\n\n/-- The sequence $P$ begins $23, 29, 59, 61, 67, 71, ...$ -/\n@[category test, AMS 11]\ntheorem erdos_1074.variants.PillaiPrimes_init :\n    nth PillaiPrimes '' (Set.Icc 0 5) = {23, 29, 59, 61, 67, 71} := by\n  sorry\n\n/-- Regarding the first question, Hardy and Subbarao computed all EHS numbers up to $2^{10}$, and\nwrite \"...if this trend conditions we expect [the limit] to be around 0.5, if it exists. The\nfrequency with which the EHS numbers occur - most often in long sequences of consecutive integers -\nmakes us believe that their asymptotic density exists and is unity. Erdős, though initially\nhesitant, later agreed with this view.\" That is, the conjecture is that $S$ has density $1$. -/\n@[category research open, AMS 11]\ntheorem erdos_1074.variants.EHSNumbers_one : EHSNumbers.HasDensity 1 := by\n  sorry\n\nend Erdos1074\n",
  "statement_hash": "fd699e2510d7bf174de7a3396de9fe41e8b257a3cd6f02942a3606d59ba3bb71",
  "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."
}