{
  "id": "5357",
  "ident": "NS.05357",
  "slug": "oeis-218585",
  "title": "Partitions $n = x + y$ with $x^2 + xy + y^2$ prime",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "Conjecture: $a(n) > 0$ for all $n > 1$ with the only exception $n = 8$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA218585.conjecture_1",
  "statement_lean": "theorem conjecture_1 (n : ℕ) (hn : 1 < n) (h8 : n ≠ 8) : 0 < a 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# Partitions $n = x + y$ with $x^2 + xy + y^2$ prime\n\nFor $n \\ge 1$, $a(n)$ is the number of ways to write $n$ as $x + y$ with $0 < x \\le y$ such that\n$x^2 + xy + y^2$ is prime.\n\n*References:*\n- [A218585](https://oeis.org/A218585)\n- E. Hecke, \"Eine neue Art von Zetafunktionen und ihre Beziehungen zur Verteilung der Primzahlen.\n  Zweite Mitteilung\", Math. Z. **6** (1920), 11–51.\n-/\n\n@[expose] public section\n\nnamespace OeisA218585\n\n/-- Number of ways to write $n = x + y$ with $0 < x \\le y$ and $x^2 + xy + y^2$ prime. -/\ndef a (n : ℕ) : ℕ :=\n  ∑ x ∈ Finset.Icc 1 (n / 2),\n    let y := n - x\n    if Nat.Prime (x ^ 2 + x * y + y ^ 2) then 1 else 0\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 0 := by decide\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by decide\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 1 := by decide\n\n@[category test, AMS 11]\ntheorem a_7 : a 7 = 2 := by decide\n\n@[category test, AMS 11]\ntheorem a_8 : a 8 = 0 := by decide\n\n/-- For a prime $p \\equiv 1 \\pmod 3$, `xp p` is the unique integer $x > 0$ such that\n$p = x^2 + xy + y^2$ with $x > y > 0$ (or $0$ if no such representation exists). -/\ndef xp (p : ℕ) : ℕ :=\n  ((List.range p).find? fun x =>\n    (List.range x).any fun y => 0 < y && x ^ 2 + x * y + y ^ 2 == p).getD 0\n\n/-- For a prime $p \\equiv 1 \\pmod 3$, `yp p` is the unique integer $y > 0$ such that\n$p = x^2 + xy + y^2$ with $x > y > 0$ (or $0$ if no such representation exists). -/\ndef yp (p : ℕ) : ℕ :=\n  ((List.range p).find? fun y =>\n    0 < y && (List.Ico (y + 1) p).any fun x => x ^ 2 + x * y + y ^ 2 == p).getD 0\n\n/--\nConjecture: $a(n) > 0$ for all $n > 1$ with the only exception $n = 8$.\n-/\n@[category research open, AMS 11]\ntheorem conjecture_1 (n : ℕ) (hn : 1 < n) (h8 : n ≠ 8) : 0 < a n := by\n  sorry\n\n/--\nConjecture: The number of primes of the form $nx + (n - x)^2$\nwith $0 < x < n / 3$ is positive for $n > 12$.\n- _Zak Seidov_, Sep 25 2013\n-/\n@[category research open, AMS 11]\ntheorem conjecture_2 (n : ℕ) (hn : 12 < n) :\n    ∃ x : ℕ, 0 < x ∧ 3 * x < n ∧ Nat.Prime (n * x + (n - x) ^ 2) := by\n  sorry\n\n/--\n$$\\lim_{N \\to \\infty} \\frac{\\sum_{p < N, \\, p \\equiv 1 \\pmod 3} x(p)}{\\sum_{p < N, \\, p \\equiv 1 \\pmod 3} y(p)} = 1 + \\sqrt{3},$$\nwhere for a prime $p \\equiv 1 \\pmod 3$, $x(p) > y(p) > 0$ are the unique positive integers such\nthat $p = x(p)^2 + x(p)y(p) + y(p)^2$.\n- _Zhi-Wei Sun_\n\nThis follows from Hecke's (1920) equidistribution theorem for Hecke Grossencharacters of\n$\\mathbb{Q}(\\sqrt{-3})$ and partial summation with the prime number theorem.\n-/\n@[category research solved, AMS 11]\ntheorem conjecture_3 :\n    Filter.atTop.Tendsto\n      (fun N : ℕ =>\n        (∑ p ∈ (Finset.range N).filter (fun p => p.Prime ∧ p % 3 = 1), (xp p : ℝ)) /\n        (∑ p ∈ (Finset.range N).filter (fun p => p.Prime ∧ p % 3 = 1), (yp p : ℝ)))\n      (nhds (1 + Real.sqrt 3)) := by\n  sorry\n\n/--\nConjecture:\n$$\\lim_{N \\to \\infty} \\frac{\\sum_{p < N, \\, p \\equiv 1 \\pmod 3} x(p)^2}{\\sum_{p < N, \\, p \\equiv 1 \\pmod 3} y(p)^2} = \\frac{52}{9},$$\nwhere for a prime $p \\equiv 1 \\pmod 3$, $x(p) > y(p) > 0$ are the unique positive integers such\nthat $p = x(p)^2 + x(p)y(p) + y(p)^2$.\n- _Zhi-Wei Sun_\n\nDisproved by Hecke's (1920) equidistribution theorem for Hecke Grossencharacters of\n$\\mathbb{Q}(\\sqrt{-3})$, which yields the true limit\n$$\\frac{\\int_0^{\\pi/6} (\\cos\\theta - \\frac{1}{\\sqrt{3}}\\sin\\theta)^2\\,d\\theta}{\\int_0^{\\pi/6} \\frac{4}{3}\\sin^2\\theta\\,d\\theta} = \\frac{2\\pi}{2\\pi - 3\\sqrt{3}} \\approx 5.780124 \\neq \\frac{52}{9}.$$\n-/\n@[category research solved, AMS 11]\ntheorem conjecture_4 :\n    ¬ Filter.atTop.Tendsto\n      (fun N : ℕ =>\n        (∑ p ∈ (Finset.range N).filter (fun p => p.Prime ∧ p % 3 = 1), ((xp p : ℝ) ^ 2)) /\n        (∑ p ∈ (Finset.range N).filter (fun p => p.Prime ∧ p % 3 = 1), ((yp p : ℝ) ^ 2)))\n      (nhds (52 / 9 : ℝ)) := by\n  sorry\n\nend OeisA218585\n",
  "statement_hash": "d4df48a0a308e84dc151c82542fc4e136f4820c74ec11bc1eeacff04e4cfd61d",
  "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."
}