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

A quadratic generating function with sign substitution

The sequence consists of the coefficients of $A(x)=1+2xA(x)^2-xA(-x)^2$.

References:

@[expose] public sectionnamespace OeisA368633

Coefficients of the square of a power series with coefficient sequence $b$.

def conv2 (b : ℕ → ℕ) (n : ℕ) : ℕ := ∑ k ∈ Finset.range (n + 1), b k * b (n - k)

Coefficients of $A(x)=1+2xA(x)^2-xA(-x)^2$.

def a : ℕ → ℕ := Nat.strongRec fun n ih => if n = 0 then 1 else let b : ℕ → ℕ := fun m => if h : m < n then ih m h else 0 (if Even n then 3 else 1) * conv2 b (n - 1)

The coefficient recurrence unfolded at an index.

n:ℕ⊢ (if n = 0 then 1 else have b := fun m ↦ if h : m < n then (fun m x ↦ Nat.strongRec (fun n ih ↦ if n = 0 then 1 else have b := fun m ↦ if h : m < n then ih m h else 0; (if Even n then 3 else 1) * conv2 b (n - 1)) m) m h else 0; (if Even n then 3 else 1) * conv2 b (n - 1)) = if n = 0 then 1 else (if Even n then 3 else 1) * conv2 (fun m ↦ if m < n then a m else 0) (n - 1) All goals completed! 🐙⊢ (if 0 = 0 then 1 else (if Even 0 then 3 else 1) * conv2 (fun m ↦ if m < 0 then a m else 0) (0 - 1)) = 1 All goals completed! 🐙⊢ (if 1 = 0 then 1 else (if Even 1 then 3 else 1) * conv2 (fun m ↦ if m < 1 then a m else 0) (1 - 1)) = 1 All goals completed! 🐙⊢ (if 2 = 0 then 1 else (if Even 2 then 3 else 1) * conv2 (fun m ↦ if m < 2 then a m else 0) (2 - 1)) = 6 All goals completed! 🐙⊢ (if 3 = 0 then 1 else (if Even 3 then 3 else 1) * conv2 (fun m ↦ if m < 3 then a m else 0) (3 - 1)) = 13 All goals completed! 🐙⊢ (if 4 = 0 then 1 else (if Even 4 then 3 else 1) * conv2 (fun m ↦ if m < 4 then a m else 0) (4 - 1)) = 114 All goals completed! 🐙

The parity conjecture (Conjecture 1): "Conjecture: $a(n)$ is odd when $n = 2^k - 1$ for $k \ge 0$ and even elsewhere."

    Paul D. Hanna, Jan 11 2024.

Lean formalization by Wentao Li, with AI assistance; see [Li26].

@[category research solved, AMS 11, formal_proof using lean4 at "https://github.com/VictorLiwentao/lean-oeis-proofs/blob/0a23974e54b90afd1453ef02c27cf8f617bad940/LeanOeisProofs/NewFormalization/A368633.lean#L166"] theorem conjecture_1 (n : ℕ) : Odd (a n) ↔ ∃ k : ℕ, n + 1 = 2 ^ k := n:ℕ⊢ Odd (a n) ↔ ∃ k, n + 1 = 2 ^ k All goals completed! 🐙end OeisA368633