/-
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 FormalConjecturesUtilConjectures associated with A109671
$a(1)=1$; thereafter, $a(2n)=a(n)$, $a(2n+1)$ is the smallest positive number such that $|a(2n+1)-a(2n-1)|=a(n)$. Conjecture: Does the sequence contain every positive integer?
References:
namespace OeisA109671
The primary defining sequence a.
$a(1)=1$; thereafter, $a(2n)=a(n)$, $a(2n+1)$ is the smallest positive number
such that $|a(2n+1)-a(2n-1)|=a(n)$.
def a (n : ℕ) : ℕ :=
if n = 0 then 0
else if n = 1 then 1
else if n % 2 = 0 then
a (n / 2)
else
let k := (n - 1) / 2
let aPrevOdd := a (n - 2)
let aMid := a k
if aPrevOdd > aMid then
aPrevOdd - aMid
else
aPrevOdd + aMid
termination_by n@[category test, AMS 11]
theorem a_1 : a 1 = 1 := ⊢ a 1 = 1 All goals completed! 🐙@[category test, AMS 11]
theorem a_2 : a 2 = 1 := ⊢ a 2 = 1 All goals completed! 🐙@[category test, AMS 11]
theorem a_3 : a 3 = 2 := ⊢ a 3 = 2 All goals completed! 🐙@[category test, AMS 11]
theorem a_4 : a 4 = 1 := ⊢ a 4 = 1 All goals completed! 🐙@[category test, AMS 11]
theorem a_5 : a 5 = 1 := ⊢ a 5 = 1 All goals completed! 🐙Does the sequence contain every positive integer (cf. A169741)?
@[category research open, AMS 11]
theorem conjecture :
answer(sorry) ↔ ∀ m : ℕ, 0 < m → ∃ n : ℕ, 0 < n ∧ a n = m := ⊢ True ↔ ∀ (m : ℕ), 0 < m → ∃ n, 0 < n ∧ OeisA109671.a n = m
All goals completed! 🐙end OeisA109671