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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Prime-th recurrence with reversal at each step

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

If zero is admitted as a starting value, then a start other than 11 does go into a loop: the sequence starting at zero is constant. This records the degenerate answer created by totalizing the one-based prime recurrence at index zero.

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

Formal statement

theorem conjecture_with_zero :
    ∃ x : ℕ, x ≠ 1 ∧ IsUltimatelyPeriodic (aStartAt x)
Show the full Challenge.lean (131 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Prime-th recurrence with reversal at each step

$$a(n) = \operatorname{reversal}(p_{a(n-1)})$$
with $a(0)=1$, where $p_k$ is the $k$-th prime number.

*References:*
- [A100475](https://oeis.org/A100475)
-/

@[expose] public section

namespace OeisA100475

open Nat List

/-- Reverses the base 10 digits of a natural number. -/
def reverseDigits (k : ℕ) : ℕ :=
  Nat.ofDigits 10 (Nat.digits 10 k |>.reverse)

/-- The primary defining sequence `a`.
a n is the Prime-th recurrence with reversal at each step.
$a(n) = \operatorname{reversal}(p_{a(n-1)})$
with $a(0)=1$, where $p_k$ is the $k$-th prime number (i.e., $p_1=2, p_2=3, \dots$). -/
noncomputable def a : ℕ → ℕ
  | 0 => 1
  | n + 1 =>
    let k := a n
    if k = 0 then 0
    else reverseDigits (Nat.nth Nat.Prime (k - 1))

@[category API, AMS 11]
lemma a_succ (n : ℕ) :
    a (n + 1) = if a n = 0 then 0 else reverseDigits (Nat.nth Nat.Prime (a n - 1)) := by
  rfl

/-- Term theorems verifying the first few values of the sequence against the official OEIS b-file -/
@[category test, AMS 11]
theorem a_0 : a 0 = 1 := by rfl

@[category test, AMS 11]
theorem a_1 : a 1 = 2 := by
  rw [a_succ]
  rw [a_0]
  simp [Nat.nth_prime_zero_eq_two, reverseDigits]

@[category test, AMS 11]
theorem a_2 : a 2 = 3 := by
  rw [a_succ]
  rw [a_1]
  simp [Nat.nth_prime_one_eq_three, reverseDigits]

@[category test, AMS 11]
theorem a_3 : a 3 = 5 := by
  rw [a_succ]
  rw [a_2]
  simp [Nat.nth_prime_two_eq_five, reverseDigits]

@[category test, AMS 11]
theorem a_4 : a 4 = 11 := by
  rw [a_succ]
  rw [a_3]
  simp [Nat.nth_prime_four_eq_eleven, reverseDigits]
  rfl

/-- Definition of the generalized sequence starting at x. -/
noncomputable def aStartAt (x : ℕ) : ℕ → ℕ
  | 0 => x
  | n + 1 =>
    let k := aStartAt x n
    if k = 0 then 0
    else reverseDigits (Nat.nth Nat.Prime (k - 1))

/-- A sequence $f : \mathbb{N} \to \mathbb{N}$ is ultimately periodic if there exist
$N, P \in \mathbb{N}$, with $P>0$, such that for all $n \ge N$, $f(n+P) = f(n)$. -/
def IsUltimatelyPeriodic (f : ℕ → ℕ) : Prop :=
  ∃ N P, P > 0 ∧ ∀ n, n ≥ N → f (n + P) = f n

/-- The totalized recurrence stays at zero when initialized at zero. The OEIS recurrence itself
uses one-based prime indices, so this is a boundary behavior of the formalization rather than a
term of the original sequence. -/
@[category API, AMS 11]
lemma aStartAt_zero (n : ℕ) : aStartAt 0 n = 0 := by
  induction n with
  | zero => rfl
  | succ n ih => simp [aStartAt, ih]

/--
If zero is admitted as a starting value, then a start other than $1$ does go into a loop: the
sequence starting at zero is constant. This records the degenerate answer created by totalizing
the one-based prime recurrence at index zero.
-/
@[category research solved, question, AMS 11]
theorem conjecture_with_zero :
    ∃ x : ℕ, x ≠ 1 ∧ IsUltimatelyPeriodic (aStartAt x) := by
  refine ⟨0, by omega, 0, 1, by omega, ?_⟩
  intro n _
  rw [aStartAt_zero, aStartAt_zero]

/--
Starting at a positive value other than $a(0) = 1$, does this sequence ever go into a loop?

The positivity hypothesis is required because the source recurrence uses the one-based prime index
`p₁ = 2`; the `x = 0` branch above is only an artifact of making `aStartAt` total on `ℕ`.
-/
@[category research open, question, AMS 11]
theorem conjecture :
    ∃ x : ℕ, 0 < x ∧ x ≠ 1 ∧ IsUltimatelyPeriodic (aStartAt x) := by
  sorry

end OeisA100475

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

nosorry fetch oeis-100475
nosorry submit oeis-100475 nosorry/oeis-100475/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.