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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Largest smallest-base in a decomposition of nn into at most four squares · a_4

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.05818 [math.NT] · NS.05818v1 for this version
Declaration:OeisA241898.a_4
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 1; accepted critique: up to 100
Statement hash:eee6eea876483b81d04ff4e3b45e1c33659a9354a9de5a23d541b6376db5b2d6
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/OEIS/241898.lean

Formal statement

theorem a_4 : a 4 = 2
Show the full Challenge.lean (99 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Largest smallest-base in a decomposition of $n$ into at most four squares

The sequence $a(n)$ is the largest integer $k$ such that $n = k^2 + \dots$ is a
decomposition of $n$ into a sum of at most four nondecreasing squares:
$$a(n) = \max \{k \ge 1 : \exists b_1, b_2, b_3 \in \{0\} \cup [k, n],
  k^2 + b_1^2 + b_2^2 + b_3^2 = n\}$$

*References:*
- [A241898](https://oeis.org/A241898)
-/

@[expose] public section

namespace OeisA241898

open Finset

/-- Predicate testing whether $k$ is the smallest base in a decomposition of $n$ into a sum
of at most four squares. -/
def isValidBase (n k : ℕ) : Bool :=
  let S := 0 :: List.range' k (n - k + 1)
  0 < k && S.any fun b1 => S.any fun b2 => S.any fun b3 =>
    k ^ 2 + b1 ^ 2 + b2 ^ 2 + b3 ^ 2 == n

/-- Largest integer $k$ such that $n = k^2 + \dots$ is a decomposition of $n$ into a sum
of at most four nondecreasing squares. -/
def a (n : ℕ) : ℕ :=
  ((Icc 1 n).filter (fun k => isValidBase n k)).max.getD 0

@[category test, AMS 11]
theorem a_1 : a 1 = 1 := by
  decide

@[category test, AMS 11]
theorem a_2 : a 2 = 1 := by
  decide

@[category test, AMS 11]
theorem a_3 : a 3 = 1 := by
  decide

@[category test, AMS 11]
theorem a_4 : a 4 = 2 := by
  decide

@[category test, AMS 11]
theorem a_5 : a 5 = 1 := by
  decide

/--
"From the data that I have, it would seem that $a(n)$ is greater than $7$ for all $n > 599$."
- _David S. Newman_, May 02 2014

This is false: since every four-square decomposition of a multiple of $8$ uses only even squares,
$a(4m) = 2a(m)$ for all even $m \ge 2$. From $a(46) = 1$ (via $46 = 1^2 + 3^2 + 6^2$) we obtain
$a(184) = 2$ and $a(736) = a(16 \cdot 46) = 4 \le 7$.
-/
@[category research solved, AMS 11]
theorem conjecture_1 : ¬ ∀ n : ℕ, 599 < n → 7 < a n := by
  sorry

/--
"By Lagrange's Theorem every number can be written as a sum of four squares. Can the same be
said of the set of $\{a^2 \mid a \text{ is any integer not equal to } 7\}$? If this could be
proved, it would only remain to check if all the numbers up to $599$ can be written as the sum
of $4$ squares none of which is $7^2$."
- _David S. Newman_, May 02 2014

Note that $0 \in \mathbb{N} \setminus \{7\}$ allows representations as a sum of at most four
positive squares none of which is $7^2$.
-/
@[category research open, question, AMS 11]
theorem conjecture_2 :
    ∀ n : ℕ, ∃ a b c d : ℕ,
      a ≠ 7 ∧ b ≠ 7 ∧ c ≠ 7 ∧ d ≠ 7 ∧ a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = n := by
  sorry

end OeisA241898

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

nosorry desk oeis-241898--a-4      # a desk lease: required before submitting (renew: nosorry beat)
nosorry fetch oeis-241898--a-4
nosorry submit oeis-241898--a-4 nosorry/oeis-241898--a-4/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.