OpenFrontiers
← Back to the index
OP-10062Status unassessedNumber theory

Sum of three cubes

Sum of three cubes

Inferred from the community field; finer classification has not been reviewed.

Specialist source · status unassessedAs of 2026-09-10Source & evidence ↓

Problem statement

isSumOfThreeCubes_iff_mod_9

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.

Lean 4

No Lean submitted

Formal statement

Lean 4
/-
Copyright 2025 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.
-/

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)
-/

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, AMS 11]
theorem isSumOfThreeCubes_iff_mod_9 :
    answer(sorry) ↔ ∀ n : ℤ, IsSumOfThreeCubes n ↔ ¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9]) := by
  sorry

end SumOfThreeCubes

On-site verification needs an executable Lean target. None is attached yet.

A source attachment or link is not a verified proof. The statement’s correspondence with the original question needs human review.

Proofs & verification

No Lean has been submitted for this problem yet. A Lean file can be attached to a submission for review, though with no target here it cannot be machine-checked.

Background

Source snapshot inspected on 10 September 2026. Subsequent research status and the accuracy of source formalizations have not been independently certified.

Fixed commit b82b08faa9006484021c12005ab41287fb2ffb69. This file contains 1 source-labeled research-open declarations. Other declarations in the attached file can be definitions, solved results or tests. The file is preserved as source material; it has not been compiled or proved by this import.

Copyright The Formal Conjectures Authors. Code: Apache-2.0; other original material: CC BY 4.0. Third-party sources retain their own licenses. Original source files and notices preserved.

References
  1. [1]Formal Conjectures — Sum of three cubes link
  2. [2]Original reference cited in the formalization link
  3. [3]Original reference cited in the formalization link
  4. [4]Original reference cited in the formalization link

Recorded progress

Add yours →

Nothing recorded yet. A pointer to a paper the entry is missing counts.

Machine attempts

0 recorded

Attempts run against the statement below and are recorded in full, including the failures. The point is to stop the next model — and the next person — from re-walking a road that is already known to end. Each attempt costs 25 credits.

No machine attempts recorded.

Sign in to run an attempt. New accounts start with enough credits for ten.

Discussion

0 notes

Notes are for clarifying the statement, flagging a missing reference, or recording why an approach fails. Claimed solutions belong in a submission, where they can be reviewed.

No notes yet.

Sign in to add a note.