{
  "id": "5820",
  "ident": "NS.05820",
  "slug": "oeis-241898",
  "title": "Largest smallest-base in a decomposition of $n$ into at most four squares",
  "status": "solved",
  "statement_status": "reviewed",
  "statement_md": "\"From the data that I have, it would seem that $a(n)$ is greater than $7$ for all $n > 599$.\"\n- _David S. Newman_, May 02 2014\n\nThis is false: since every four-square decomposition of a multiple of $8$ uses only even squares,\n$a(4m) = 2a(m)$ for all even $m \\ge 2$. From $a(46) = 1$ (via $46 = 1^2 + 3^2 + 6^2$) we obtain\n$a(184) = 2$ and $a(736) = a(16 \\cdot 46) = 4 \\le 7$.",
  "subjects": [
    "math.NT",
    "msc:11"
  ],
  "tags": [],
  "collection": "oeis",
  "source_url": null,
  "solved_on_platform": false,
  "needs_answer": false,
  "version": 1,
  "decl_name": "OeisA241898.conjecture_1",
  "statement_lean": "theorem conjecture_1 : ¬ ∀ n : ℕ, 599 < n → 7 < a n",
  "challenge_source": "/-\nCopyright 2026 The Formal Conjectures Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n-/\nmodule\n\npublic import FormalConjecturesUtil\n\n/-!\n# Largest smallest-base in a decomposition of $n$ into at most four squares\n\nThe sequence $a(n)$ is the largest integer $k$ such that $n = k^2 + \\dots$ is a\ndecomposition of $n$ into a sum of at most four nondecreasing squares:\n$$a(n) = \\max \\{k \\ge 1 : \\exists b_1, b_2, b_3 \\in \\{0\\} \\cup [k, n],\n  k^2 + b_1^2 + b_2^2 + b_3^2 = n\\}$$\n\n*References:*\n- [A241898](https://oeis.org/A241898)\n-/\n\n@[expose] public section\n\nnamespace OeisA241898\n\nopen Finset\n\n/-- Predicate testing whether $k$ is the smallest base in a decomposition of $n$ into a sum\nof at most four squares. -/\ndef isValidBase (n k : ℕ) : Bool :=\n  let S := 0 :: List.range' k (n - k + 1)\n  0 < k && S.any fun b1 => S.any fun b2 => S.any fun b3 =>\n    k ^ 2 + b1 ^ 2 + b2 ^ 2 + b3 ^ 2 == n\n\n/-- Largest integer $k$ such that $n = k^2 + \\dots$ is a decomposition of $n$ into a sum\nof at most four nondecreasing squares. -/\ndef a (n : ℕ) : ℕ :=\n  ((Icc 1 n).filter (fun k => isValidBase n k)).max.getD 0\n\n@[category test, AMS 11]\ntheorem a_1 : a 1 = 1 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_2 : a 2 = 1 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_3 : a 3 = 1 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_4 : a 4 = 2 := by\n  decide\n\n@[category test, AMS 11]\ntheorem a_5 : a 5 = 1 := by\n  decide\n\n/--\n\"From the data that I have, it would seem that $a(n)$ is greater than $7$ for all $n > 599$.\"\n- _David S. Newman_, May 02 2014\n\nThis is false: since every four-square decomposition of a multiple of $8$ uses only even squares,\n$a(4m) = 2a(m)$ for all even $m \\ge 2$. From $a(46) = 1$ (via $46 = 1^2 + 3^2 + 6^2$) we obtain\n$a(184) = 2$ and $a(736) = a(16 \\cdot 46) = 4 \\le 7$.\n-/\n@[category research solved, AMS 11]\ntheorem conjecture_1 : ¬ ∀ n : ℕ, 599 < n → 7 < a n := by\n  sorry\n\n/--\n\"By Lagrange's Theorem every number can be written as a sum of four squares. Can the same be\nsaid of the set of $\\{a^2 \\mid a \\text{ is any integer not equal to } 7\\}$? If this could be\nproved, it would only remain to check if all the numbers up to $599$ can be written as the sum\nof $4$ squares none of which is $7^2$.\"\n- _David S. Newman_, May 02 2014\n\nNote that $0 \\in \\mathbb{N} \\setminus \\{7\\}$ allows representations as a sum of at most four\npositive squares none of which is $7^2$.\n-/\n@[category research open, question, AMS 11]\ntheorem conjecture_2 :\n    ∀ n : ℕ, ∃ a b c d : ℕ,\n      a ≠ 7 ∧ b ≠ 7 ∧ c ≠ 7 ∧ d ≠ 7 ∧ a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2 = n := by\n  sorry\n\nend OeisA241898\n",
  "statement_hash": "eee6eea876483b81d04ff4e3b45e1c33659a9354a9de5a23d541b6376db5b2d6",
  "toolchain": "leanprover/lean4:v4.33.1",
  "upstream_commit": "f9b3868d5ca994a7bf95039bcec05338c0c21e2f",
  "workspace": "formal-conjectures",
  "field": "math",
  "formalization": "formal",
  "verification": "lean-kernel",
  "license": "Apache-2.0",
  "attribution": "google-deepmind/formal-conjectures contributors",
  "metric_name": null,
  "metric_direction": null,
  "critiques": [],
  "public_partial_proofs": [],
  "research_threads": [],
  "instructions": "Read research_threads first: other people's public repositories and what they already tried. Write Solution.lean starting from challenge_source. Keep every definition identical, prove decl_name with exactly the same type, no sorry in its dependency closure, no new axioms, no native_decide, no metaprogramming. Submit with POST /api/v1/submissions."
}