/- 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(n) = 3a(n-1) + a(n-2) - 3a(n-3)$ *References:* - [A103425](https://oeis.org/A103425) -/ @[expose] public section namespace OeisA103425 /-- The primary defining sequence `a`. $a(n)$ is defined by the recurrence relation $a(n) = 3 a(n-1) + a(n-2) - 3 a(n-3)$ with initial terms $a(0)=1, a(1)=3, a(2)=5$. -/ def a : ℕ → ℕ | 0 => 1 | 1 => 3 | 2 => 5 | n + 3 => 3 * a (n + 2) + a (n + 1) - 3 * a n /-- Term theorems verifying the first few values of the sequence against the official OEIS b-file -/ @[category test, AMS 11] theorem a_0 : a 0 = 1 := by decide @[category test, AMS 11] theorem a_1 : a 1 = 3 := by decide @[category test, AMS 11] theorem a_2 : a 2 = 5 := by decide @[category test, AMS 11] theorem a_3 : a 3 = 15 := by decide @[category test, AMS 11] theorem a_4 : a 4 = 41 := by decide def IsWeightedTribonacci (a b c : ℤ) (x : ℕ → ℤ) : Prop := ∀ n, x (n + 3) = a * x (n + 2) + b * x (n + 1) + c * x n set_option linter.style.formal_proof_palomar false in /-- The current sequence contains primes, including $3, 5, 41, 21523361$. Is there an $(a, b, c)$ weighted tribonacci sequence with $a, b, c$ relatively prime which is prime-free? Yes: take $(a, b, c) = (1, 1, -1)$ and the constant sequence $x(n) = 4$. The linked Lean proof is by Kenta Kitamura. -/ @[category research solved, question, AMS 11, formal_proof using lean4 at "https://github.com/KitaKen1/oeis-a103425-prime-free/blob/b04b155/lean/OeisA103425FC.lean#L13-L35"] theorem conjecture : ∃ (a b c : ℤ) (x : ℕ → ℤ), Nat.gcd (Int.gcd a b) c.natAbs = 1 ∧ IsWeightedTribonacci a b c x ∧ ∀ n, ¬ (x n).natAbs.Prime := by sorry /-- Is there a non-constant $(a, b, c)$ weighted tribonacci sequence with $a, b, c$ relatively prime which is prime-free? Yes: take $(a, b, c) = (1, 1, -1)$ and $x(n) = 4(n + 1)$. -/ @[category research solved, question, AMS 11] theorem conjecture.variants.nonconstant : ∃ (a b c : ℤ) (x : ℕ → ℤ), Nat.gcd (Int.gcd a b) c.natAbs = 1 ∧ IsWeightedTribonacci a b c x ∧ (∃ m n, x m ≠ x n) ∧ ∀ n, ¬ (x n).natAbs.Prime := by refine ⟨1, 1, -1, fun n ↦ 4 * (n + 1), by norm_num, fun n ↦ by push_cast; ring, ⟨0, 1, by norm_num⟩, fun n ↦ ?_⟩ rw [show (4 * ((n : ℤ) + 1)).natAbs = 4 * (n + 1) by omega, Nat.prime_mul_iff] norm_num /-- Is there a non-constant $(a, b, c)$ weighted tribonacci sequence with $a, b, c$ relatively prime and pairwise distinct which is prime-free? Yes: take $(a, b, c) = (3, -3, 1)$ and $x(n) = (n + 2)^2$. -/ @[category research solved, question, AMS 11] theorem conjecture.variants.nonconstant_distinct_coeffs : ∃ (a b c : ℤ) (x : ℕ → ℤ), Nat.gcd (Int.gcd a b) c.natAbs = 1 ∧ a ≠ b ∧ a ≠ c ∧ b ≠ c ∧ IsWeightedTribonacci a b c x ∧ (∃ m n, x m ≠ x n) ∧ ∀ n, ¬ (x n).natAbs.Prime := by refine ⟨3, -3, 1, fun n ↦ (n + 2) ^ 2, by norm_num, by norm_num, by norm_num, by norm_num, fun n ↦ by push_cast; ring, ⟨0, 1, by norm_num⟩, fun n ↦ ?_⟩ rw [Int.natAbs_pow] exact Nat.Prime.not_prime_pow le_rfl end OeisA103425