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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Rowland's GCD prime-generating recurrence

Source:Wikipedia lists of open problems
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Rowland's theorem (2008): for every n≥2n \ge 2, the step d(n)=a(n)−a(n−1)d(n) = a(n) - a(n - 1) equals 11 or is prime.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.08406 [math.NT] · NS.08406v1 for this version
Declaration:RowlandSequence.rowland_diff_eq_one_or_prime
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:e02ffc70e9ba60085f34b8efad795380fb8c57eec028e074c049b2a454770ca7
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Wikipedia/RowlandSequence.lean

Formal statement

theorem rowland_diff_eq_one_or_prime {n : ℕ} (hn : 2 ≤ n) :
    rowlandDiff n = 1 ∨ (rowlandDiff n).Prime
Show the full Challenge.lean (88 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Rowland's GCD prime-generating recurrence

Define $a(1) = 7$ and $a(n) = a(n - 1) + \gcd(n, a(n - 1))$ for $n \ge 2$ (`OEIS A106108`), with
step increments $d(n) = a(n) - a(n - 1) = \gcd(n, a(n - 1))$ (`OEIS A132199` lists $d(n + 1)$ for
$n \ge 1$). Eric S. Rowland established in 2008 that every $d(n)$ with $n \ge 2$ equals $1$ or an
odd prime, and conjectured that every odd prime arises as $d(n)$ for some $n \ge 2$.

*References:*
- [Wikipedia](https://en.wikipedia.org/wiki/Formula_for_primes#Rowland%27s_prime-generating_sequence)
- [OEIS A106108](https://oeis.org/A106108)
- [OEIS A132199](https://oeis.org/A132199)
- E. S. Rowland, *A natural prime-generating recurrence*, J. Integer Seq. **11** (2008),
  Article 08.2.8.
-/

@[expose] public section

namespace RowlandSequence

/-- Rowland's sequence (`OEIS A106108`), starting at $a(1) = 7$ with recurrence
$a(n) = a(n - 1) + \gcd(n, a(n - 1))$ for $n \ge 2$ (and $a(0) = 0$). -/
def rowlandSeq : ℕ → ℕ
  | 0 => 0
  | 1 => 7
  | n + 2 =>
    let prev := rowlandSeq (n + 1)
    prev + Nat.gcd (n + 2) prev

/-- Step increment $d(n) = a(n) - a(n - 1)$ of `rowlandSeq` (meaningful for $n \ge 2$; shifted by
one from `OEIS A132199`, where `A132199(n) = rowlandDiff (n + 1)`). -/
def rowlandDiff (n : ℕ) : ℕ :=
  rowlandSeq n - rowlandSeq (n - 1)

/-- Checks the initial values $a(1), \dots, a(6) = 7, 8, 9, 10, 15, 18$ of `rowlandSeq`. -/
@[category test, AMS 11]
theorem rowlandSeq_initial_values :
    rowlandSeq 1 = 7 ∧ rowlandSeq 2 = 8 ∧ rowlandSeq 3 = 9 ∧
      rowlandSeq 4 = 10 ∧ rowlandSeq 5 = 15 ∧ rowlandSeq 6 = 18 := by
  decide

/-- Checks $d(2) = 1$ alongside the odd-prime increments $d(5) = 5$, $d(6) = 3$, and
$d(11) = 11$. -/
@[category test, AMS 11]
theorem rowlandDiff_small_witnesses :
    rowlandDiff 2 = 1 ∧ rowlandDiff 5 = 5 ∧ rowlandDiff 6 = 3 ∧ rowlandDiff 11 = 11 := by
  decide

/--
Rowland's theorem (2008): for every $n \ge 2$, the step $d(n) = a(n) - a(n - 1)$ equals $1$ or is
prime.
-/
@[category research solved, AMS 11]
theorem rowland_diff_eq_one_or_prime {n : ℕ} (hn : 2 ≤ n) :
    rowlandDiff n = 1 ∨ (rowlandDiff n).Prime := by
  sorry

/--
Rowland's conjecture (2008): every odd prime $p$ occurs as $d(n) = a(n) - a(n - 1)$ at some index
$n \ge 2$. The prime $2$ is excluded because $n$ and $a(n - 1)$ always have opposite parity, and
$n \ge 2$ excludes the artifact `rowlandDiff 1 = 7`.
-/
@[category research open, AMS 11]
theorem rowland_generates_all_odd_primes {p : ℕ} (hp : p.Prime) (hodd : Odd p) :
    ∃ n : ℕ, 2 ≤ n ∧ rowlandDiff n = p := by
  sorry

end RowlandSequence

To prove it: keep every definition of Challenge.lean unchanged and prove RowlandSequence.rowland_diff_eq_one_or_prime with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_rowland_diff_eq_one_or_prime : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry fetch wikipedia-rowlandsequence
nosorry submit wikipedia-rowlandsequence nosorry/wikipedia-rowlandsequence/Solution.lean --wait

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.