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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Periodicity of kk-th prime factors in coupled nonlinear recurrence a(n)a(n)

Source:OEIS conjectures
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Conjecture: For any k>1k > 1, if you take the kk-th prime factor of each term, you get an eventually periodic sequence. - Bryle Morga, Mar 31 2025

Here the kk-th prime factor of a(n)a(n) is the kk-th smallest distinct prime divisor of ∣a(n)∣|a(n)|; for example the second prime factors of a(5)=18a(5) = 18, a(6)=20a(6) = 20 and a(7)=896a(7) = 896 are 33, 55 and 77.

This was proved by Terence Tao in a MathOverflow answer, using that a(n)a(n) divides a(n+3)a(n+3) for all nn. Lean formalization by Wentao Li, with AI assistance.

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

Formal statement

theorem kthPrimeFactor_periodic : ∀ k : ℕ, k ≥ 2 → ∃ N₀ p : ℕ, p > 0 ∧
    ∀ n : ℕ, n ≥ N₀ → kthPrimeFactor k (a (n + p)) = kthPrimeFactor k (a n)
Show the full Challenge.lean (119 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Periodicity of $k$-th prime factors in coupled nonlinear recurrence $a(n)$

The sequence $a(n)$ is defined by $a(n) = a(n-1)b(n-2) + a(n-2)b(n-1)$
where $b(n) = a(n-1)b(n-2) - a(n-2)b(n-1)$, with $a(0) = b(0) = b(1) = 1$ and $a(1) = 2$.

*References:*
- [A382590](https://oeis.org/A382590)
- [mathoverflow/490330](https://mathoverflow.net/questions/490330): B. Morga, "Peculiar family of
  recurrence formula where for $n>1$ if you take the $n$-th prime factor of each term, you get an
  eventually periodic sequence", Mar. 31, 2025.
-/

@[expose] public section

namespace OeisA382590


open Int

/--
Helper function for a, computing the pair $(a(n), b(n))$ such that:
$a(n) = a(n-1)b(n-2) + a(n-2)b(n-1)$
$b(n) = a(n-1)b(n-2) - a(n-2)b(n-1)$
-/
def abPair : ℕ → ℤ × ℤ
| 0 => (1, 1)
| 1 => (2, 1)
| n + 2 =>
  let (a_n_plus_1, b_n_plus_1) := abPair (n + 1)
  let (a_n, b_n) := abPair n
  (a_n_plus_1 * b_n + a_n * b_n_plus_1, a_n_plus_1 * b_n - a_n * b_n_plus_1)

/--
The sequence defined by the mutual recurrence relations:
$a(n) = a(n-1)b(n-2) + a(n-2)b(n-1)$ and $b(n) = a(n-1)b(n-2) - a(n-2)b(n-1)$
starting with $a(0) = b(0) = b(1) = 1$ and $a(1) = 2$.
The terms are in $\mathbb{Z}$ due to negative values.
-/
def a (n : ℕ) : ℤ := (abPair n).fst

open Nat

/--
The $k$-th smallest distinct prime factor of an integer $n$ (where $k \ge 1$).
This is defined as the $k$-th element (0-indexed $k-1$) of the increasing list of
distinct prime factors of `n.natAbs`.
Returns 1 if n has fewer than k distinct prime factors or if n is 0, 1, or -1,
following the informal convention.
-/
def kthPrimeFactor (k : ℕ) (n : ℤ) : ℕ :=
  if h₀ : k = 0 then 1 else
  let L := (primeFactorsList n.natAbs).dedup
  if h_len : k - 1 ≥ L.length then 1 else
  L[k - 1]

@[category test, AMS 11]
lemma kthPrimeFactor_two_a_six : kthPrimeFactor 2 (a 6) = 5 := by decide +kernel

@[category test, AMS 11]
lemma kthPrimeFactor_two_a_seven : kthPrimeFactor 2 (a 7) = 7 := by decide +kernel


@[category test, AMS 11]
lemma a_0 : a 0 = 1 := by rfl

@[category test, AMS 11]
lemma a_1 : a 1 = 2 := by rfl

@[category test, AMS 11]
lemma a_2 : a 2 = 3 := by rfl

@[category test, AMS 11]
lemma a_3 : a 3 = 5 := by rfl

@[category test, AMS 11]
lemma a_4 : a 4 = 8 := by rfl


set_option linter.style.formal_proof_palomar false in
/--
Conjecture: For any $k > 1$, if you take the $k$-th prime factor of each term, you get an
eventually periodic sequence. - _Bryle Morga_, Mar 31 2025

Here the $k$-th prime factor of $a(n)$ is the $k$-th smallest distinct prime divisor of
$|a(n)|$; for example the second prime factors of $a(5) = 18$, $a(6) = 20$ and $a(7) = 896$
are $3$, $5$ and $7$.

This was proved by Terence Tao in a [MathOverflow answer](https://mathoverflow.net/a/490348),
using that $a(n)$ divides $a(n+3)$ for all $n$.
Lean formalization by Wentao Li, with AI assistance.
-/
@[category research solved, AMS 11,
  formal_proof using lean4 at "https://github.com/VictorLiwentao/lean-oeis-proofs/blob/0a23974e54b90afd1453ef02c27cf8f617bad940/LeanOeisProofs/NewFormalization/A382590.lean#L201"]
theorem kthPrimeFactor_periodic : ∀ k : ℕ, k ≥ 2 → ∃ N₀ p : ℕ, p > 0 ∧
    ∀ n : ℕ, n ≥ N₀ → kthPrimeFactor k (a (n + p)) = kthPrimeFactor k (a n) := by
    sorry

end OeisA382590

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

nosorry fetch oeis-382590
nosorry submit oeis-382590 nosorry/oeis-382590/Solution.lean --wait

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.