Show full file and definitions
/-
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
/-!
# Recurrence with bitwise XOR
The sequence is defined by $a(0) = 0$, $a(1) = 1$, and for $n \ge 0$,
$$a(n+2) = (a(n+1) \mathbin{\mathrm{XOR}} (n+2)) - a(n),$$
where $\mathrm{XOR}$ is the bitwise exclusive-or operator on integers.
*References:*
- [A182510](https://oeis.org/A182510)-/
@[expose] public section
namespace OeisA182510
/-- Defining recurrence for $a(n)$. -/
def a : ℕ → ℤ
| 0 => 0
| 1 => 1
| n + 2 => Int.xor (a (n + 1)) (n + 2 : ℤ) - a n
@[category test, AMS 11]
theorem a_0 : a 0 = 0 := by rfl
@[category test, AMS 11]
theorem a_1 : a 1 = 1 := by rfl
@[category test, AMS 11]
theorem a_2 : a 2 = 3 := by rfl
@[category test, AMS 11]
theorem a_3 : a 3 = -1 := by rfl
@[category test, AMS 11]
theorem a_4 : a 4 = -8 := by rfl
@[category test, AMS 11]
theorem a_5 : a 5 = -2 := by rfl
@[category test, AMS 11]
theorem a_6 : a 6 = 0 := by rfl
/--
Conjecture: the sequence contains 8 zeros.-/
@[category research open, AMS 11]
theorem conjecture1 : Set.ncard {n : ℕ | a n = 0} = 8 := by
sorry
/--
Conjecture: more positive terms than negative.
As $n \to \infty$, the count of positive terms is greater than the count of negative terms.
The requirement that $n$ is large enough is needed, since the claim fails for $n = 100$.
-/
@[category research open, AMS 11]
theorem conjecture2 :
∀ᶠ n in Filter.atTop,
((Finset.range n).filter (fun k => a k < 0)).card <
((Finset.range n).filter (fun k => 0 < a k)).card := by
sorry
end OeisA182510