/- Copyright 2026 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

Smallest prime $p$ such that $p + n$ is an $n$-th power

Smallest prime $p$ such that $p + n$ is an $n$-th power, or $0$ if no such number exists. That is, the smallest prime of the form $k^n - n$.

References:

namespace OeisA84046

Smallest prime $p$ such that $p + n$ is an $n$-th power, or $0$ if no such prime exists.

noncomputable def a (n : ) : := sInf {p : | p.Prime k : , k ^ n = p + n}

Value of the sequence a at 0.

All goals completed! 🐙

Value of the sequence a at 1.

h_least:IsLeast {p | Nat.Prime p k, k ^ 1 = p + 1} 2a 1 = 2 All goals completed! 🐙

Value of the sequence a at 2.

h_least:IsLeast {p | Nat.Prime p k, k ^ 2 = p + 2} 2a 2 = 2 All goals completed! 🐙

Value of the sequence a at 3.

h_least:IsLeast {p | Nat.Prime p k, k ^ 3 = p + 3} 5a 3 = 5 All goals completed! 🐙

Conjecture: if a(k) = 0 then k is an even square.

@[category research open, AMS 11] theorem conjecture (k : ) (h : a k = 0) : m : , k = (2 * m) ^ 2 := k:h:a k = 0 m, k = (2 * m) ^ 2 All goals completed! 🐙end OeisA84046