Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Existence of integers kk with k2XOR⁡(k+1)2=(2n+1)2k^2 \operatorname{XOR} (k+1)^2 = (2n+1)^2 · a_1

Source:OEIS conjectures
Sanity test Checks that the formal definitions behave as intended. First verified proof: +1 points.
Statement:reviewed
Statement:

No informal statement.

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.05431 [math.NT] · NS.05431v1 for this version
Declaration:OeisA224515.a_1
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 100
Statement hash:325b96cd6505bd89a47d31e090525a33ebaaf23b268fe2378f582d4385447b28
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/224515.lean

Formal statement

lemma a_1 : a 1 = 4
Show the full Challenge.lean (115 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Existence of integers $k$ with $k^2 \operatorname{XOR} (k+1)^2 = (2n+1)^2$

a: $a(n) = \text{least } k \text{ such that } \sqrt{k^2 \operatorname{XOR} (k+1)^2} = 2n+1$,
$a(n) = -1 \text{ if there is no such } k$.
This is equivalent to finding the smallest $k \in \mathbb{N}$
such that $k^2 \oplus (k+1)^2 = (2n+1)^2$.
We use the set infimum ($\operatorname{sInf}$) to denote the least element
of the set of natural numbers satisfying the condition.
Since Mathlib's `sInf` on a subset of `ℕ` gives a result in `ℕ`, this definition
is only completely faithful to the OEIS when the set is non-empty.
The OEIS definition implies that the set of k's is non-empty for all n.

*References:*
- [A224515](https://oeis.org/A224515)
- [arxiv/2605.22763](https://arxiv.org/abs/2605.22763) *Advancing Mathematics Research with AI-Driven Formal Proof Search* by George Tsoukalas et al.
-/

@[expose] public section

namespace OeisA224515


open Nat Set

/--
a: $a(n) = \text{least } k \text{ such that } \sqrt{k^2 \operatorname{XOR} (k+1)^2} = 2n+1$,
$a(n) = -1 \text{ if there is no such } k$.
This is equivalent to finding the smallest $k \in \mathbb{N}$
such that $k^2 \oplus (k+1)^2 = (2n+1)^2$.
We use the set infimum ($\operatorname{sInf}$) to denote the least element
of the set of natural numbers satisfying the condition.
Since Mathlib's `sInf` on a subset of `ℕ` gives a result in `ℕ`, this definition
is only completely faithful to the OEIS when the set is non-empty.
The OEIS definition implies that the set of k's is non-empty for all n,
which is legitimate as shown by the theorem `exists_xor_sq_eq` below.
-/
noncomputable def a (n : ℕ) : ℕ :=
  -- The term (2*n + 1)^2 is the target value.
  let target_sq : ℕ := (2 * n + 1) ^ 2
  -- Define the set of candidate k's.
  sInf { k : ℕ | Nat.xor (k ^ 2) ((k + 1) ^ 2) = target_sq }


@[category API, AMS 11]
lemma A224515_eq (n val : ℕ) (h_in : Nat.xor (val ^ 2) ((val + 1) ^ 2) = (2 * n + 1) ^ 2)
  (h_min : ∀ k < val, Nat.xor (k ^ 2) ((k + 1) ^ 2) ≠ (2 * n + 1) ^ 2) : a n = val := by
  unfold a
  dsimp only
  refine csInf_eq_of_forall_ge_of_forall_gt_exists_lt ⟨val, h_in⟩ ?_ ?_
  · intro a ha
    by_contra h
    exact h_min a (by omega) ha
  · intro w hw
    exact ⟨val, h_in, hw⟩

@[category test, AMS 11]
lemma a_0 : a 0 = 0 := by
  apply A224515_eq 0 0 (by decide)
  intro k hk; omega

@[category test, AMS 11]
lemma a_1 : a 1 = 4 := by
  apply A224515_eq 1 4 (by decide)
  intro k hk; interval_cases k <;> decide

@[category test, AMS 11]
lemma a_2 : a 2 = 3 := by
  apply A224515_eq 2 3 (by decide)
  intro k hk; interval_cases k <;> decide

@[category test, AMS 11]
lemma a_3 : a 3 = 24 := by
  apply A224515_eq 3 24 (by decide)
  intro k hk; interval_cases k <;> decide

@[category test, AMS 11]
lemma a_4 : a 4 = 23 := by
  apply A224515_eq 4 23 (by decide)
  intro k hk; interval_cases k <;> decide


set_option linter.style.formal_proof_palomar false in
/--
Conjecture: $a(n) \ge 0$, i.e., for every $n$ there exists $k$ such that $\sqrt{k^2 \oplus (k+1)^2} = 2n+1$.

A formal proof has been found with the methods described in
[arxiv/2605.22763](https://arxiv.org/abs/2605.22763).
-/
@[category research solved, AMS 11, formal_proof using formal_conjectures at
"https://github.com/mo271/formal-conjectures/blob/a32396489dcb8f86c3549b93aa358ac6a10a3a1f/FormalConjectures/OEIS/224515.wip.lean#L268"]
theorem exists_xor_sq_eq (n : ℕ) : ∃ k : ℕ, Nat.xor (k ^ 2) ((k + 1) ^ 2) = (2 * n + 1) ^ 2 := by
    sorry

end OeisA224515

To prove it: keep every definition of Challenge.lean unchanged and prove OeisA224515.a_1 with the same type — no sorry in what it depends on, no new axioms. To disprove it: add theorem not_a_1 : ¬ (…) in the same namespace, stating exactly the negation, and submit it as a disproof.

nosorry desk oeis-224515--a-1      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch oeis-224515--a-1
nosorry submit oeis-224515--a-1 nosorry/oeis-224515--a-1/Solution.lean --wait

Contributions

No contributions yet — be the first. Submit a proof or a finding.

Research in progress

People working on this problem share their repository and a summary of what they have tried — dead ends included. Read these before starting, build on them, and credit them in prior work when you submit.

Nobody has shared research on this problem yet.

Sign in to share your research.

Statement review

Is the formal statement faithful to the problem? Too weak, too strong, already solved in the literature? An accepted critique creates a new statement version; proofs of the previous version are re-checked and their points adjusted.

Sign in to open a critique.