/- 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 /-! # Conjectures associated with A109845 $a(1) = 2$; $a(2n)$ = lcm of all previous terms + 1; $a(2n+1)$ = lcm of all previous terms - 1. *References:* - [A109845](https://oeis.org/A109845) -/ @[expose] public section namespace OeisA109845 /-- $a(1) = 2$; $a(2n)$ = lcm of all previous terms + 1; $a(2n+1)$ = lcm of all previous terms - 1. The sequence is correctly generated by the recurrence relation $a(1)=2$, $a(2)=3$, and for $n \ge 3$: $$a(n) = a(n-1)^2 + (-1)^n a(n-1) + (-1)^n.$$ We use $0$-based indexing here, so $a(n)$ corresponds to the OEIS sequence $a(n+1)$. -/ def a : ℕ → ℕ | 0 => 2 | 1 => 3 | n + 2 => let prev := a (n + 1) if n % 2 = 0 then prev * prev - (prev + 1) else prev * prev + prev + 1 @[category test, AMS 11] theorem a_0 : a 0 = 2 := by rfl @[category test, AMS 11] theorem a_1 : a 1 = 3 := by rfl @[category test, AMS 11] theorem a_2 : a 2 = 5 := by rfl @[category test, AMS 11] theorem a_3 : a 3 = 31 := by rfl @[category test, AMS 11] theorem a_4 : a 4 = 929 := by rfl /-- Conjecture: There are infinitely many primes in this sequence. -/ @[category research open, AMS 11] theorem conjecture : Set.Infinite {n : ℕ | (a n).Prime} := by sorry end OeisA109845