Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The two-direction panmagic squares of order three

Proved
MagicSquares.panmagic_count_three

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

combinatoricsenumerative-combinatoricsmagic-squares

The order-three two-direction panmagic count. This statement is about the stronger predicate IsPanMagic, which requires both families of broken diagonals (descending and ascending) to sum to the line sum, and it determines

P3both(t)={1,3∣t,0,3∤t.P^{\mathrm{both}}_{3}(t)=\begin{cases}1,&3\mid t,\\ 0,&3\nmid t.\end{cases}P3both​(t)={1,0,​3∣t,3∤t.​

The single square at line sum 3e3e3e is the constant array with every entry eee. Context. The purpose of this node is to sit next to pandiagonal_count_three so that the two readings of "pandiagonal" are both present on the platform and cannot be confused: the one-direction reading used by the counting literature gives a degree-two polynomial that never vanishes, whereas the two-direction reading collapses to the constant square and vanishes off multiples of three. Citing one in place of the other is the most likely faithfulness error in this area.

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

theorem panmagic_count_three (t : ℕ) : panMagicCount 3 t = if 3 ∣ t then 1 else 0 := by sorry

end MagicSquares
Source
M. Beck, M. Cohen, J. Cuomo and P. Gribelyuk, The number of "magic" squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707--717 (arXiv:math/0201013).

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