/- 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. -/ module public import FormalConjecturesUtil

Smallest integer $s > n$ such that $1 + 2s + 3s^2 + \dots + n s^{n-1}$ is prime

For $n \ge 2$, $a(n)$ is the smallest integer $s > n$ such that the sum $P_n(s) = \sum_{k=0}^{n-1} (k+1) s^k$ is a prime number.

References:

@[expose] public sectionnamespace OeisA217785

polyP n s is the sum $\sum_{k=0}^{n-1} (k+1) s^k$.

def polyP (n s : ℕ) : ℕ := ∑ k ∈ Finset.range n, (k + 1) * s ^ kopen scoped Classical in

Smallest integer $s > n$ such that polyP n s is prime, or none if no such $s$ exists.

noncomputable def a (n : ℕ) : Option ℕ := if ∃ s : ℕ, n < s ∧ Nat.Prime (polyP n s) then some (sInf {s : ℕ | n < s ∧ Nat.Prime (polyP n s)}) else noneAll goals completed! 🐙All goals completed! 🐙All goals completed! 🐙All goals completed! 🐙All goals completed! 🐙

The polynomial $s_n(x) = \sum_{k=0}^n (k+1) x^k$ over $\mathbb{Z}[x]$.

noncomputable def polyS (n : ℕ) : Polynomial ℤ := ∑ k ∈ Finset.range (n + 1), Polynomial.C (k + 1 : ℤ) * Polynomial.X ^ k

Conjecture: For each $n \ge 2$, there are infinitely many primes of the form $1 + 2s + \dots + n s^{n-1}$ where $s$ is a positive integer.

@[category research open, AMS 11] theorem conjecture_1 (n : ℕ) (hn : 2 ≤ n) : {s : ℕ | 0 < s ∧ Nat.Prime (polyP n s)}.Infinite := n:ℕhn:2 ≤ n⊢ {s | 0 < s ∧ Nat.Prime (polyP n s)}.Infinite All goals completed! 🐙

Conjecture: For each $n \ge 2$, $a(n) < 12 n^2$.

@[category research open, AMS 11] theorem conjecture_2 (n : ℕ) (hn : 2 ≤ n) : ∃ m < 12 * n ^ 2, a n = some m := n:ℕhn:2 ≤ n⊢ ∃ m < 12 * n ^ 2, a n = some m All goals completed! 🐙

Conjecture: The polynomials $s_n(x) = \sum_{k=0}^n (k+1) x^k$ for $n \ge 1$ are all irreducible over the field of rational numbers.

@[category research open, AMS 11 12] theorem conjecture_3 (n : ℕ) (hn : 1 ≤ n) : Irreducible (Polynomial.map (Int.castRingHom ℚ) (polyS n)) := n:ℕhn:1 ≤ n⊢ Irreducible (Polynomial.map (Int.castRingHom ℚ) (polyS n)) All goals completed! 🐙

Conjecture: For $n \ge 1$, the polynomial $s_n(x) = \sum_{k=0}^n (k+1) x^k$ is reducible modulo every prime if and only if $n$ has the form $8k(k+1)$ where $k$ is a positive integer.

@[category research open, AMS 11 12] theorem conjecture_4 (n : ℕ) (hn : 1 ≤ n) : (∀ p : ℕ, p.Prime → ¬ Irreducible (Polynomial.map (Int.castRingHom (ZMod p)) (polyS n))) ↔ ∃ k : ℕ, 0 < k ∧ n = 8 * k * (k + 1) := n:ℕhn:1 ≤ n⊢ (∀ (p : ℕ), Nat.Prime p → ¬Irreducible (Polynomial.map (Int.castRingHom (ZMod p)) (polyS n))) ↔ ∃ k, 0 < k ∧ n = 8 * k * (k + 1) All goals completed! 🐙end OeisA217785