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

A108306: Expansion of $(3x+1)/(1-3x-3x^2)$

This sequence satisfies the linear recurrence relation $a(0)=1$, $a(1)=6$, and $a(n) = 3a(n-1) + 3a(n-2)$ for $n \ge 2$.

References:

namespace OeisA108306

The primary defining sequence a. a n is the $n$-th term of the expansion of $(3x+1)/(1-3x-3x^2)$, satisfying $a(0)=1, a(1)=6, a(n)=3a(n-1)+3a(n-2)$.

def a : | 0 => 1 | 1 => 6 | k + 2 => 3 * a (k + 1) + 3 * a k@[category test, AMS 11] theorem a_0 : a 0 = 1 := a 0 = 1 All goals completed! 🐙@[category test, AMS 11] theorem a_1 : a 1 = 6 := a 1 = 6 All goals completed! 🐙@[category test, AMS 11] theorem a_2 : a 2 = 21 := a 2 = 21 All goals completed! 🐙@[category test, AMS 11] theorem a_3 : a 3 = 81 := a 3 = 81 All goals completed! 🐙@[category test, AMS 11] theorem a_4 : a 4 = 306 := a 4 = 306 All goals completed! 🐙open Matrix

The matrix for the specific case $a=5, b=2$. $$M = \begin{pmatrix} 1 & 5 \cr 1 & 2 \end{pmatrix}$$

def m : Matrix (Fin 2) (Fin 2) := fun i j => match i, j with | 0, 0 => 1 | 0, 1 => 5 | 1, 0 => 1 | 1, 1 => 2

The sequence is the INVERT transform of (1, 5, 10, 20, 40, 80, 160, ...) and can be obtained by extracting the upper left terms of matrix powers of [(1,5); (1,2)]. These results are a case (a=5, b=2) of the general conjecture below.

@[category textbook, AMS 11] theorem a_is_invert_transform_case (n : ) : a n = (m ^ (n + 1)) 0 0 := n:a n = (m ^ (n + 1)) 0 0 All goals completed! 🐙

The c sequence for the general INVERT transform conjecture. $c(1) = 1$, $c(k)=ab^(k-2)$ for $k \ge 2$.

def invertSeqC (a b : ) : | 0 => 0 | 1 => 1 | (k + 2) => a * b^k

The INVERT transform of the sequence c.

noncomputable def invertSeqD (a b : ) (n : ) : := Nat.strongRecOn n (fun m ih => if m = 0 then 1 else i Finset.range m, if h : i < m then invertSeqC a b (m - i) * ih i h else 0)

The general 2x2 matrix [(1,a); (1,b)].

def genMatrix (a b : ) : Matrix (Fin 2) (Fin 2) := fun i j => match i, j with | 0, 0 => 1 | 0, 1 => a | 1, 0 => 1 | 1, 1 => b

The conjecture: The INVERT transform of a sequence starting $(1, a, ab, ab^2, ab^3, \ldots)$ is equivalent to extracting the upper left terms of powers of the 2x2 matrix [(1,a); (1,b)].

@[category research solved, AMS 11, formal_proof using lean4 at "https://github.com/KitaKen1/oeis-108306/blob/2e01e81b20a56880993e174ee4af0f0d7af37bdd/lean/OeisA108306FC.lean#L101-L106"] theorem conjecture (a_val b_val n : ) : invertSeqD a_val b_val n = (genMatrix a_val b_val ^ n) 0 0 := a_val:b_val:n:invertSeqD a_val b_val n = (genMatrix a_val b_val ^ n) 0 0 All goals completed! 🐙end OeisA108306