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

Smallest number $k$ such that $kn + 1$ is prime

References:

namespace OeisA34693open Filter

Smallest number $k$ such that $kn + 1$ is prime.

noncomputable def a (n : ) : := Nat.nth (fun k (k * n + 1).Prime) 0@[category test, AMS 11] theorem a_0 : a 0 = 0 := a 0 = 0 All goals completed! 🐙@[category test, AMS 11] theorem a_1 : a 1 = 1 := a 1 = 1 conv_rhs => rw [ Nat.nth_count (p := fun k (k + 1).Prime) (n := 1) (Nat.Prime (1 + 1) All goals completed! 🐙)] All goals completed! 🐙@[category test, AMS 11] theorem a_2 : a 2 = 1 := a 2 = 1 conv_rhs => rw [ Nat.nth_count (p := fun k (k * 2 + 1).Prime) (n := 1) (Nat.Prime (1 * 2 + 1) All goals completed! 🐙)] All goals completed! 🐙@[category test, AMS 11] theorem a_3 : a 3 = 2 := a 3 = 2 conv_rhs => rw [ Nat.nth_count (p := fun k (k * 3 + 1).Prime) (n := 2) (Nat.Prime (2 * 3 + 1) All goals completed! 🐙)] All goals completed! 🐙@[category test, AMS 11] theorem a_7 : a 7 = 4 := a 7 = 4 conv_rhs => rw [ Nat.nth_count (p := fun k (k * 7 + 1).Prime) (n := 4) (Nat.Prime (4 * 7 + 1) All goals completed! 🐙)] All goals completed! 🐙

Conjecture: for every $n > 1$ there exists a number $k < n$ such that $nk + 1$ is a prime.

@[category research open, AMS 11] theorem exists_k {n : } (hn : 1 < n) : k < n, (n * k + 1).Prime := n:hn:1 < n k < n, Nat.Prime (n * k + 1) All goals completed! 🐙

A stronger conjecture: for every n there exists a number $k < 1 + n^{0.75}$ such that $nk + 1$ is a prime.

@[category research open, AMS 11] theorem exists_k_stronger {n : } (hn : 0 < n) : k : , k < 1 + (Real.nthRoot 4 n) ^ 3 (n * k + 1).Prime := n:hn:0 < n k, k < 1 + Real.nthRoot 4 n ^ 3 Nat.Prime (n * k + 1) All goals completed! 🐙

The expression $1 + n^{0.74}$ does not work as an upper bound.

hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:k < 1 + Real.nthRoot 100 19 ^ 74hk10:k < 10hk10':k < 10¬Nat.Prime (19 * k + 1) hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:0 < 1 + Real.nthRoot 100 19 ^ 74hk10:0 < 10hk10':0 < 10¬Nat.Prime (19 * 0 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:1 < 1 + Real.nthRoot 100 19 ^ 74hk10:1 < 10hk10':1 < 10¬Nat.Prime (19 * 1 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:2 < 1 + Real.nthRoot 100 19 ^ 74hk10:2 < 10hk10':2 < 10¬Nat.Prime (19 * 2 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:3 < 1 + Real.nthRoot 100 19 ^ 74hk10:3 < 10hk10':3 < 10¬Nat.Prime (19 * 3 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:4 < 1 + Real.nthRoot 100 19 ^ 74hk10:4 < 10hk10':4 < 10¬Nat.Prime (19 * 4 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:5 < 1 + Real.nthRoot 100 19 ^ 74hk10:5 < 10hk10':5 < 10¬Nat.Prime (19 * 5 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:6 < 1 + Real.nthRoot 100 19 ^ 74hk10:6 < 10hk10':6 < 10¬Nat.Prime (19 * 6 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:7 < 1 + Real.nthRoot 100 19 ^ 74hk10:7 < 10hk10':7 < 10¬Nat.Prime (19 * 7 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:8 < 1 + Real.nthRoot 100 19 ^ 74hk10:8 < 10hk10':8 < 10¬Nat.Prime (19 * 8 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:9 < 1 + Real.nthRoot 100 19 ^ 74hk10:9 < 10hk10':9 < 10¬Nat.Prime (19 * 9 + 1) hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:0 < 1 + Real.nthRoot 100 19 ^ 74hk10:0 < 10hk10':0 < 10¬Nat.Prime (19 * 0 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:1 < 1 + Real.nthRoot 100 19 ^ 74hk10:1 < 10hk10':1 < 10¬Nat.Prime (19 * 1 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:2 < 1 + Real.nthRoot 100 19 ^ 74hk10:2 < 10hk10':2 < 10¬Nat.Prime (19 * 2 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:3 < 1 + Real.nthRoot 100 19 ^ 74hk10:3 < 10hk10':3 < 10¬Nat.Prime (19 * 3 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:4 < 1 + Real.nthRoot 100 19 ^ 74hk10:4 < 10hk10':4 < 10¬Nat.Prime (19 * 4 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:5 < 1 + Real.nthRoot 100 19 ^ 74hk10:5 < 10hk10':5 < 10¬Nat.Prime (19 * 5 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:6 < 1 + Real.nthRoot 100 19 ^ 74hk10:6 < 10hk10':6 < 10¬Nat.Prime (19 * 6 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:7 < 1 + Real.nthRoot 100 19 ^ 74hk10:7 < 10hk10':7 < 10¬Nat.Prime (19 * 7 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:8 < 1 + Real.nthRoot 100 19 ^ 74hk10:8 < 10hk10':8 < 10¬Nat.Prime (19 * 8 + 1)hy:Real.nthRoot 100 19 = 19 ^ (↑100)⁻¹h100:Real.nthRoot 100 19 ^ 100 = 19hb:Real.nthRoot 100 19 ^ 74 9k:hk:9 < 1 + Real.nthRoot 100 19 ^ 74hk10:9 < 10hk10':9 < 10¬Nat.Prime (19 * 9 + 1) All goals completed! 🐙

Conjecture: $a(n) = O(\log(n)\log(\log(n)))$.

@[category research open, AMS 11] theorem a_isBigO : (fun n (a n : )) =O[atTop] (fun n Real.log n * Real.log (Real.log n)) := (fun n (a n)) =O[atTop] fun n Real.log n * Real.log (Real.log n) All goals completed! 🐙

Counter-conjecture to a_isBigO: $a(n) / (\log n \log \log n)$ is unbounded.

@[category research open, AMS 11] theorem a_unbounded : ¬BddAbove (Set.range fun n a n / (Real.log n * Real.log (Real.log n))) := ¬BddAbove (Set.range fun n (a n) / (Real.log n * Real.log (Real.log n))) All goals completed! 🐙end OeisA34693