/-
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 FormalConjecturesUtilPronic indices for odd coefficients of $\sum_{n \ge 0} x^n \frac{(1+x^n)^n}{(1+x^{n+1})^{n+1}}$
Coefficients of G.f. $\sum_{n\ge 0} x^n \cdot \frac{(1 + x^n)^n}{(1 + x^{n+1})^{n+1}}$. The $m$-th term $a(m)$ is the coefficient of $x^m$, which is explicitly given by the sum: $$ a(m) = \sum_{n=0}^m \sum_{k=0}^n \binom{n}{k} (-1)^j \binom{n+j}{j},$$ where $j = \frac{m - n(k+1)}{n+1}$, and the term is zero unless $j$ is a natural number.
References:
arxiv/2605.22763 Advancing Mathematics Research with AI-Driven Formal Proof Search by George Tsoukalas et al.
@[expose] public sectionnamespace OeisA323557open NatCoefficients of G.f. $\sum_{n\ge 0} x^n \cdot \frac{(1 + x^n)^n}{(1 + x^{n+1})^{n+1}}$. The $m$-th term $a(m)$ is the coefficient of $x^m$, which is explicitly given by the sum: $$ a(m) = \sum_{n=0}^m \sum_{k=0}^n \binom{n}{k} (-1)^j \binom{n+j}{j},$$ where $j = \frac{m - n(k+1)}{n+1}$, and the term is zero unless $j$ is a natural number.
def a (m : ℕ) : ℤ :=
Finset.sum (Finset.range (m + 1)) fun n =>
Finset.sum (Finset.range (n + 1)) fun k =>
let exp_x_num := n * (k + 1)
if exp_x_num ≤ m then
let remainder := m - exp_x_num
if (n + 1) ∣ remainder then
let j : ℕ := remainder / (n + 1)
let c₁ : ℤ := (n.choose k)
let c₂ : ℤ := (choose (n + j) j)
let sign : ℤ := if Even j then 1 else -1
sign * c₁ * c₂
else
0
else
0@[category test, AMS 11]
lemma a_0 : a 0 = 1 := ⊢ a 0 = 1 All goals completed! 🐙@[category test, AMS 11]
lemma a_1 : a 1 = 0 := ⊢ a 1 = 0 All goals completed! 🐙@[category test, AMS 11]
lemma a_2 : a 2 = 3 := ⊢ a 2 = 3 All goals completed! 🐙@[category test, AMS 11]
lemma a_3 : a 3 = -2 := ⊢ a 3 = -2 All goals completed! 🐙@[category test, AMS 11]
lemma a_4 : a 4 = 2 := ⊢ a 4 = 2 All goals completed! 🐙Conjecture: Odd terms occur only at positions $n(n+1)$ for $n \ge 0$ (verified for initial 32600 terms).
A formal proof has been found with the methods described in arxiv/2605.22763.
This statement is equivalent to OeisA325046.odd_a_implies_pronic. The two sequences differ
only by the sign $(-1)^j$ on each summand, so they agree modulo $2$ and have the same odd
indices.
@[category research solved, AMS 11, formal_proof using formal_conjectures at
"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/323557.wip.lean#L193"]
theorem odd_a_implies_pronic (m : ℕ) : Odd (a m) → ∃ n : ℕ, m = n * (n + 1) := m:ℕ⊢ Odd (a m) → ∃ n, m = n * (n + 1)
All goals completed! 🐙end OeisA323557