Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

No 3x3 magic square has a line sum coprime to 3

Proved
MagicSquares.magic_count_three_otherwise

by Yuxuan Xu · Sep 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatoricsmagic-squares

If ttt is not divisible by 333, there is no 3×33 \times 33×3 magic square with line sum ttt.

Write M3(t)M_{3}(t)M3​(t) for the number of 3×33 \times 33×3 arrays of nonnegative integers whose three rows, three columns and two main diagonals all sum to ttt. Then

3∤t  ⟹  M3(t)=0.3 \nmid t \;\Longrightarrow\; M_{3}(t) = 0 .3∤t⟹M3​(t)=0.

This is an immediate consequence of the fact that the centre entry satisfies 3M1,1=t3M_{1,1} = t3M1,1​=t; see MagicSquares.center_of_order_three. Together with MagicSquares.magic_count_three_divisible this determines M3M_{3}M3​ completely.

Preamble
import Mathlib
import Definitions.Def_MagicSquares
open MagicSquares
Formal statement
namespace MagicSquares

theorem magic_count_three_otherwise (t : ℕ) (ht : ¬ 3 ∣ t) :
    magicCount 3 t = 0 := by sorry

end MagicSquares
Source
Beck, Cohen, Cuomo & Gribelyuk, The number of ``magic'' squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707-717; arXiv:math/0201013v3, Section 2, MacMahon's formula for M3(t)M_{3}(t)M3​(t) (1915).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, licensed under Apache 2.0.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTermsJoin SlackJoin Zulip© 2026 Prove2Me