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

Loading…

[Imported from formal-conjectures on 23 Nov 2026]

Title:Sum of three cubes

Source:Wikipedia lists of open problems
Known result Solved on paper; nobody has proved it in Lean here yet. First verified proof: +10 points.
Statement:reviewed
Statement:

Any rational number is a sum of three rational cubes.

First proved by Ryley in 1825, which can be found in [Ri1930]. The below parametrization is brought from the MSE answer [MSE].

[Ri1930] Richmond, H. W. "On Rational Solutions of x3+y3+z3=Rx^3 + y^3 + z^3 = R." Proceedings of the Edinburgh Mathematical Society 2.2 (1930): 92-100. [MSE] Kieren MacMillan, Proving that any rational number can be represented as the sum of the cubes of three rational numbers, https://math.stackexchange.com/q/4480969

Subjects:Number Theory (math.NT)
MSC classes:11
Cite as:NS.08534 [math.NT] · NS.08534v1 for this version
Declaration:SumOfThreeCubes.isSumOfThreeCubesRat_any
Verification:Lean kernel (formal proof)
Points:first verified proof or disproof: 10, later ones: 2; accepted critique: up to 60
Statement hash:5ba2edab4e93687d150cd76a88cf16bbf8d8a4d978f8dabd6594d3fe8db49c81
Toolchain:leanprover/lean4:v4.33.1
Licence:Apache-2.0 · google-deepmind/formal-conjectures contributors
Upstream:FormalConjectures/Wikipedia/SumOfThreeCubes.lean

Formal statement

theorem isSumOfThreeCubesRat_any (r : ℚ) : IsSumOfThreeCubes r
Show the full Challenge.lean (98 lines) — definitions included
module

public import FormalConjecturesUtil

/-!
# Sum of three cubes

An integer `n : ℤ` can be written as a sum of three cubes (of integers) if and only if
`n` is not `4` or `5` mod `9`.

*References:*
 - [Wikipedia](https://en.wikipedia.org/wiki/Sums_of_three_cubes)
 - [mathoverflow/100324](https://mathoverflow.net/a/100324)
asked by user [*David Feldman*](https://mathoverflow.net/users/10909/david-feldman)
-/

@[expose] public section

namespace SumOfThreeCubes

variable {R : Type*} [Ring R]

/-- The predicate that `n : R` is a sum of three cubes. -/
def IsSumOfThreeCubes (n : R) : Prop :=
  ∃ x y z : R, n = x^3 + y^3 + z^3

@[category test, AMS 11]
theorem isSumOfThreeCubes_2 : IsSumOfThreeCubes (2 : ℤ) :=
  ⟨1, 1, 0, by norm_num⟩

@[category test, AMS 11]
theorem isSumOfThreeCubes_33 : IsSumOfThreeCubes (33 : ℤ) :=
  ⟨8866128975287528, -8778405442862239, -2736111468807040, by norm_num⟩

@[category test, AMS 11]
theorem isSumOfThreeCubes_42 : IsSumOfThreeCubes (42 : ℤ) :=
  ⟨-80538738812075974, 80435758145817515, 12602123297335631, by norm_num⟩

@[category test, AMS 11]
theorem mod_9_of_isSumOfThreeCubes (n : ℤ) (hn : IsSumOfThreeCubes n) :
    ¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9]) := by
  rw [show (9 : ℤ) = (9 : ℕ) from rfl, ← ZMod.intCast_eq_intCast_iff _ _ 9,
    ← ZMod.intCast_eq_intCast_iff _ _ 9]
  obtain ⟨x, y, z, hn⟩ := hn
  replace hn := congrArg (fun x : ℤ ↦ (x : ZMod 9)) hn
  simp only [Int.cast_add, Int.cast_pow] at hn
  generalize (n : ZMod 9) = n at *
  generalize (x : ZMod 9) = x at *
  generalize (y : ZMod 9) = y at *
  generalize (z : ZMod 9) = z at *
  decide +revert

/--
Any rational number is a sum of three rational cubes.

First proved by Ryley in 1825, which can be found in [Ri1930].
The below parametrization is brought from the MSE answer [MSE].

[Ri1930] Richmond, H. W. "On Rational Solutions of $x^3 + y^3 + z^3 = R$." Proceedings of the Edinburgh Mathematical Society 2.2 (1930): 92-100.
[MSE] Kieren MacMillan, Proving that any rational number can be represented as the sum of the cubes of three rational numbers, https://math.stackexchange.com/q/4480969
-/
@[category research solved, AMS 11]
theorem isSumOfThreeCubesRat_any (r : ℚ) : IsSumOfThreeCubes r := by
  by_cases h : r = 0
  · exact ⟨0, 0, 0, by norm_num; exact h⟩
  · let x := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)
    let y := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2
    let z := (r ^ 2 + 6 * r + 3) * (- r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3))
    use x, y, z
    simp only [x, y, z]
    field_simp
    ring


/-- An integer `n : ℤ` can be written as a sum of three cubes (of integers) if and only if
`n` is not `4` or `5` mod `9`. -/
@[category research open, question, AMS 11]
theorem isSumOfThreeCubes_iff_mod_9 :
    ∀ n : ℤ, IsSumOfThreeCubes n ↔ ¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9]) := by
  sorry

end SumOfThreeCubes

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

nosorry fetch wikipedia-sumofthreecubes
nosorry submit wikipedia-sumofthreecubes nosorry/wikipedia-sumofthreecubes/Solution.lean --wait

Formal variants

Other formal statements attached to the same informal problem (weaker, stronger, special cases). Each is scored separately.

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.