/- Copyright 2025 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -/ import FormalConjecturesUtil

Erdős Problem 1055

Reference: erdosproblems.com/1055

namespace Erdos1055

A prime $p$ is in class $1$ if the only prime divisors of $p+1$ are $2$ or $3$. In general, a prime $p$ is in class $r$ if every prime factor of $p+1$ is in some class $\leq r-1$, with equality for at least one prime factor.

The classes partition the primes, so IsOfClass r p says that $p$ is in class exactly $r$: the first conjunct of the successor case rules out every class $\leq r - 1$ for $p$ itself. Without it IsOfClass 2 would also hold of every prime of class $1$, because at $r = 2$ the "with equality" clause quantifies over the single value $m = 1$ and so says nothing.

def IsOfClass : ℕ+ Prop := fun r PNat.caseStrongInductionOn (p := fun (_ : ℕ+) Prop) r (fun p (p + 1).primeFactors {2, 3}) (fun n H p ( (m : ℕ+) (hm : m n), ¬ H m hm p) ( r (p + 1).primeFactors, (m : ℕ+) (hm : m n), H m hm r) ( r (p + 1).primeFactors, (m : ℕ+) (hm : m n), H m hm r m = n))

A prime $p$ is in class $1$ if the only prime divisors of $p+1$ are $2$ or $3$. In general, a prime $p$ is in class $r$ if every prime factor of $p+1$ is in some class $\leq r-1$, with equality for at least one prime factor. Show that for each $r$ there exists a prime $p$ of class $r$.

@[category textbook, AMS 11] theorem exists_p (r : ℕ+) : p, p.Prime IsOfClass r p := r:ℕ+ p, Nat.Prime p IsOfClass r p All goals completed! 🐙

A prime $p$ is in class $1$ if the only prime divisors of $p+1$ are $2$ or $3$. In general, a prime $p$ is in class $r$ if every prime factor of $p+1$ is in some class $\leq r-1$, with equality for at least one prime factor. Let $p_r$ is the least prime in class $r$.

noncomputable def p (r : ℕ+) : := open scoped Classical in Nat.find (exists_p r)

A prime $p$ is in class $1$ if the only prime divisors of $p+1$ are $2$ or $3$. In general, a prime $p$ is in class $r$ if every prime factor of $p+1$ is in some class $\leq r-1$, with equality for at least one prime factor. Are there infinitely many primes in each class?

@[category research open, AMS 11] theorem erdos_1055 (r) : {p | p.Prime IsOfClass r p}.Infinite := r:ℕ+{p | Nat.Prime p IsOfClass r p}.Infinite All goals completed! 🐙

A prime $p$ is in class $1$ if the only prime divisors of $p+1$ are $2$ or $3$. In general, a prime $p$ is in class $r$ if every prime factor of $p+1$ is in some class $\leq r-1$, with equality for at least one prime factor. If $p_r$ is the least prime in class $r$, then how does $p_r^{1/r}$ behave? Erdos conjectured that this tends to infinity.

@[category research open, AMS 11] theorem erdos_1055.variants.erdos_limit : Filter.atTop.Tendsto (fun r (p r : ) ^ (1 / r : )) Filter.atTop := Filter.Tendsto (fun r (p r) ^ (1 / r)) Filter.atTop Filter.atTop All goals completed! 🐙

A prime $p$ is in class $1$ if the only prime divisors of $p+1$ are $2$ or $3$. In general, a prime $p$ is in class $r$ if every prime factor of $p+1$ is in some class $\leq r-1$, with equality for at least one prime factor. If $p_r$ is the least prime in class $r$, then how does $p_r^{1/r}$ behave? Selfridge conjectured that this is bounded.

@[category research open, AMS 11] theorem erdos_1055.variants.selfridge_limit : M, r, (p r : ) ^ (1 / r : ) M := M, (r : ℕ+), (p r) ^ (1 / r) M All goals completed! 🐙-- TODO(Paul-Lez): formalize the rest of the problems on the page. end Erdos1055