{
  "id": "8288",
  "ident": "NS.08288",
  "slug": "wikipedia-pell",
  "title": "Infinitude of Pell number primes",
  "status": "open",
  "statement_status": "reviewed",
  "statement_md": "There are infinitely many prime Pell numbers",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "wikipedia",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "PellNumbers.infinite_pellNumber_primes",
  "statement_lean": "theorem infinite_pellNumber_primes : Infinite {n : ℕ | Prime (pellNumber 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# Infinitude of Pell number primes\n\n*References:*\n - [Wikipedia](https://en.wikipedia.org/wiki/Pell_number#Primes_and_squares)\n - [A86383](https://oeis.org/A86383)\n\nThe Pell numbers $P_n$ are defined by $P_0 = 0$,\n$P_1 = 1$, $P_{n+2} = 2*P_{n+1} + P_n$. [OEIS A129](https://oeis.org/A129)\n\nThe conjecture says that there are infinitely many prime Pell numbers.\n-/\n\n@[expose] public section\n\nnamespace PellNumbers\n\n/-- The *Pell numbers* $P_n$ are defined by $P_0 = 0$, $P_1 = 1$, $P_{n+2} = 2*P_{n+1} + P_n$ -/\ndef pellNumber : ℕ → ℕ\n  | 0 => 0\n  | 1 => 1\n  | n + 1 + 1 => 2 * pellNumber (n + 1) + pellNumber n\n\n/-- The initial Pell number is $P_0 = 0$. -/\n@[category test, AMS 11]\ntheorem pellNumber_zero : pellNumber 0 = 0 := rfl\n\n/-- The second initial value is $P_1 = 1$. -/\n@[category test, AMS 11]\ntheorem pellNumber_one : pellNumber 1 = 1 := rfl\n\n/-- The recurrence gives $P_2 = 2$. -/\n@[category test, AMS 11]\ntheorem pellNumber_two : pellNumber 2 = 2 := rfl\n\n/-- The Pell number at index $5$ is $P_5 = 29$. -/\n@[category test, AMS 11]\ntheorem pellNumber_five : pellNumber 5 = 29 := rfl\n\n/-- Similar to Fibonacci numbers, there exist numerous identities around Pell numbers, i.e.\nP_{2n+1} = P_n ^ 2 + P_{n+1} ^ 2 -/\n@[category textbook, AMS 11]\ntheorem pellNumber_sq_add_pellNumber_succ_sq (n : ℕ) :\n    pellNumber (2 * n + 1) = pellNumber n ^ 2 + pellNumber (n + 1) ^ 2 := by\n  -- Prove jointly with the even-index companion\n  --   P(2n+2) = 2 · P(n+1) · (P(n) + P(n+1)),\n  -- since each successive case needs both formulas at the previous index.\n  suffices h : ∀ n,\n      pellNumber (2 * n + 1) = pellNumber n ^ 2 + pellNumber (n + 1) ^ 2 ∧\n      pellNumber (2 * n + 2) =\n        2 * pellNumber (n + 1) * (pellNumber n + pellNumber (n + 1)) by\n    exact (h n).1\n  intro n\n  induction n with\n  | zero => refine ⟨?_, ?_⟩ <;> rfl\n  | succ k ih =>\n    obtain ⟨hA, hB⟩ := ih\n    -- The Pell recursion at the next pair of indices.\n    have hstep1 : pellNumber (2 * (k + 1) + 1) =\n        2 * pellNumber (2 * k + 2) + pellNumber (2 * k + 1) := by\n      show pellNumber (2 * k + 1 + 1 + 1) =\n        2 * pellNumber (2 * k + 1 + 1) + pellNumber (2 * k + 1)\n      rfl\n    have hstep2 : pellNumber (2 * (k + 1) + 2) =\n        2 * pellNumber (2 * (k + 1) + 1) + pellNumber (2 * k + 2) := by\n      show pellNumber (2 * k + 2 + 1 + 1) =\n        2 * pellNumber (2 * k + 2 + 1) + pellNumber (2 * k + 2)\n      rfl\n    have hk2 : pellNumber (k + 2) = 2 * pellNumber (k + 1) + pellNumber k := rfl\n    -- A(k+1): prove once, use as first conjunct and inside the B(k+1) step.\n    have hA' : pellNumber (2 * (k + 1) + 1) =\n        pellNumber (k + 1) ^ 2 + pellNumber (k + 2) ^ 2 := by\n      rw [hstep1, hA, hB, hk2]; ring\n    refine ⟨hA', ?_⟩\n    rw [hstep2, hA', hB, hk2]; ring\n\n/-- An explicit formula for Pell numbers, similar to Binet's formula -/\n@[category textbook, AMS 11]\ntheorem coe_pellNumber_eq : ∀ n, (pellNumber n : ℝ) = ((1 + √2) ^ n - (1 - √2) ^ n) / (2 * √2) := by\n  -- The characteristic polynomial of the Pell recursion is $x^2 = 2x + 1$, with\n  -- roots $\\alpha = 1 + \\sqrt{2}$ and $\\beta = 1 - \\sqrt{2}$. The function\n  -- $f(n) = (\\alpha^n - \\beta^n) / (2\\sqrt{2})$ satisfies the same recursion\n  -- and the same base cases, so it agrees with the cast of `pellNumber`.\n  set α : ℝ := 1 + √2 with hα_def\n  set β : ℝ := 1 - √2 with hβ_def\n  -- Basic facts about α and β.\n  have hsq2 : (√2 : ℝ) ^ 2 = 2 := Real.sq_sqrt (by norm_num)\n  have hα_sq : α ^ 2 = 2 * α + 1 := by rw [hα_def]; ring_nf; linarith [hsq2]\n  have hβ_sq : β ^ 2 = 2 * β + 1 := by rw [hβ_def]; ring_nf; linarith [hsq2]\n  have h2sq2_ne : (2 * √2 : ℝ) ≠ 0 :=\n    mul_ne_zero two_ne_zero (Real.sqrt_ne_zero'.mpr (by norm_num))\n  -- The characteristic-poly identity lifts to $x^{n+2} = 2 x^{n+1} + x^n$.\n  have hα_rec : ∀ n, α ^ (n + 2) = 2 * α ^ (n + 1) + α ^ n := by\n    intro n\n    have : α ^ (n + 2) = α ^ n * α ^ 2 := by ring\n    rw [this, hα_sq]; ring\n  have hβ_rec : ∀ n, β ^ (n + 2) = 2 * β ^ (n + 1) + β ^ n := by\n    intro n\n    have : β ^ (n + 2) = β ^ n * β ^ 2 := by ring\n    rw [this, hβ_sq]; ring\n  -- Joint induction on consecutive indices.\n  suffices h : ∀ n,\n      (pellNumber n : ℝ) = (α ^ n - β ^ n) / (2 * √2) ∧\n      (pellNumber (n + 1) : ℝ) = (α ^ (n + 1) - β ^ (n + 1)) / (2 * √2) from\n    fun n => (h n).1\n  intro n\n  induction n with\n  | zero =>\n    refine ⟨?_, ?_⟩\n    · simp [pellNumber]\n    · -- pellNumber 1 = 1 and (α - β) / (2√2) = (2√2) / (2√2) = 1.\n      simp only [pellNumber, pow_one, Nat.cast_one, zero_add]\n      rw [hα_def, hβ_def]\n      field_simp; ring\n  | succ k ih =>\n    obtain ⟨hk, hk1⟩ := ih\n    refine ⟨hk1, ?_⟩\n    -- pellNumber (k+2) = 2 * pellNumber (k+1) + pellNumber k, both sides cast to ℝ.\n    have hrec : pellNumber (k + 1 + 1) = 2 * pellNumber (k + 1) + pellNumber k := rfl\n    show (pellNumber (k + 1 + 1) : ℝ) = (α ^ (k + 1 + 1) - β ^ (k + 1 + 1)) / (2 * √2)\n    rw [hrec]\n    push_cast\n    rw [hk1, hk, hα_rec k, hβ_rec k]\n    field_simp\n    ring\n\n/-- There are infinitely many prime Pell numbers -/\n@[category research open, AMS 11]\ntheorem infinite_pellNumber_primes : Infinite {n : ℕ | Prime (pellNumber n)} := by\n  sorry\n\n-- TODO : Formalise connection between Pell numbers and Pell equation x^2 - 2*y^2 = -1\n\nend PellNumbers\n",
  "statement_hash": "f786bb1884fde192cd1882d672cf8df0571ca4f45b3f7db4a2271ac1184b5b39",
  "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."
}