Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

No panmagic squares of order three when the line sum is not divisible by three

Proved
MagicSquares.pan_three_otherwise

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

combinatoricsenumerative-combinatoricsmagic-squares

The zero case for panmagic squares.

Writing Pn(t)P_{n}(t)Pn​(t) for the number of panmagic squares of order nnn and line sum ttt, the theorem is

3∤t  ⟹  P3(t)=0.3\nmid t\implies P_{3}(t)=0 .3∤t⟹P3​(t)=0.

It complements the evaluation P3(3e)=1P_{3}(3e)=1P3​(3e)=1: together they give the complete count P3(t)=1P_{3}(t)=1P3​(t)=1 for 3∣t3\mid t3∣t and P3(t)=0P_{3}(t)=0P3​(t)=0 otherwise.

Proof. A panmagic square is in particular a magic square, because the broken diagonals of offset 000 are exactly the two main diagonals. For a magic square of order three and line sum ttt, the classical centre identity center_of_order_three gives 3c=t3c=t3c=t where ccc is the centre entry. Hence 3∣t3\mid t3∣t, and the square cannot exist when ttt is not divisible by three.

Context. This is the standard divisibility obstruction for order-three magic squares: the centre is forced to be one third of the line sum, so line sums indivisible by three are impossible for any class that contains the magic squares. The same argument already gave the vanishing of the plain magic count magic_count_three_otherwise and of the semi-magic count; what the present statement adds is only the observation that panmagicity is stronger than magicity, so the obstruction is inherited.

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

theorem pan_three_otherwise (t : ℕ) (ht : ¬ 3 ∣ t) : panMagicCount 3 t = 0 := by sorry

end MagicSquares
Source
P. A. MacMahon, Combinatory Analysis, Vol. II, Cambridge University Press, 1916; M. Beck, T. Cohen, J. Cuomo and P. Gribelyuk, The number of "magic" squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707--717 (arXiv:math/0201013); W. S. Andrews, Magic Squares and Cubes, 2nd ed., Dover, 1960.
Human review
  • Endorsed by Shuze Chen · Sep 18, 2026

  • Endorsed by Yuxuan Xu · Sep 18, 2026

    Confirmed by the mission captain (proposal self-audit).

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