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

Number of primes in $n$-th row of triangle $k^2 - k + p_n$

$a(n)$ is the number of primes in the $n$-th row of the triangle $T(n, k) = k^2 - k + p_n$ for $1 \le k \le n$, where $p_n$ is the $n$-th prime ($p_1=2, p_2=3, \dots$).

References:

namespace OeisA117531

Number of primes in the $n$-th row of $T(n, k) = k^2 - k + p_n$ for $1 \le k \le n$.

noncomputable def a (n : ) : := let pn : := Nat.nth Nat.Prime (n - 1) Finset.card ((Finset.Icc 1 n).filter fun k => (k ^ 2 - k + pn).Prime)

Value of the sequence a at 0.

@[category test, AMS 11] theorem a_0 : a 0 = 0 := a 0 = 0 All goals completed! 🐙

Value of the sequence a at 1.

All goals completed! 🐙

Value of the sequence a at 2.

All goals completed! 🐙

Value of the sequence a at 3.

h_two:Nat.nth Nat.Prime (3 - 1) = 5h3:Finset.Icc 1 3 = {1, 2, 3}this:{k {1, 2, 3} | Nat.Prime (k ^ 2 - k + 5)} = {1, 2, 3}{1, 2, 3}.card = 3 All goals completed! 🐙

Value of the sequence a at 4.

h_three:Nat.nth Nat.Prime (4 - 1) = 7h4:Finset.Icc 1 4 = {1, 2, 3, 4}this:{k {1, 2, 3, 4} | Nat.Prime (k ^ 2 - k + 7)} = {1, 3, 4}{1, 3, 4}.card = 3 All goals completed! 🐙

Conjecture: $a(n) < n$ for $n > 13$.

@[category research open, AMS 11] theorem conjecture (n : ) (h : n > 13) : a n < n := n:h:n > 13a n < n All goals completed! 🐙end OeisA117531