Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Counting the normalized coefficient vectors

Proved
MagicSquares.sm3_params_card

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

combinatoricsenumerative-combinatoricsmagic-squares

The number of normalized coefficient vectors — six nonnegative integers summing to ttt whose odd part (x,y,z)(x,y,z)(x,y,z) has minimum 000 — is

sm3Count(t)=3(t+34)+(t+22).\mathrm{sm3Count}(t)=3\binom{t+3}{4}+\binom{t+2}{2}.sm3Count(t)=3(4t+3​)+(2t+2​).

Proof. Partition the vectors according to the first zero among (x,y,z)(x,y,z)(x,y,z). If x=0x=0x=0 the remaining five coordinates are arbitrary nonnegative integers summing to ttt, giving (t+44)\binom{t+4}{4}(4t+4​) vectors. If x>0x>0x>0 and y=0y=0y=0, subtract 111 from xxx and the remaining five coordinates sum to t−1t-1t−1, giving (t+34)\binom{t+3}{4}(4t+3​). If x>0x>0x>0, y>0y>0y>0 and z=0z=0z=0, subtract 111 from each of xxx and yyy and the remaining five sum to t−2t-2t−2, giving (t+24)\binom{t+2}{4}(4t+2​). Hence

sm3Count(t)=(t+44)+(t+34)+(t+24).\mathrm{sm3Count}(t)=\binom{t+4}{4}+\binom{t+3}{4}+\binom{t+2}{4}.sm3Count(t)=(4t+4​)+(4t+3​)+(4t+2​).

Two applications of Pascal's identity collapse this to MacMahon's form: (t+44)=(t+34)+(t+33)\binom{t+4}{4}=\binom{t+3}{4}+\binom{t+3}{3}(4t+4​)=(4t+3​)+(3t+3​) and (t+34)=(t+24)+(t+23)\binom{t+3}{4}=\binom{t+2}{4}+\binom{t+2}{3}(4t+3​)=(4t+2​)+(3t+2​), so the sum equals 3(t+34)+((t+33)−(t+23))3\binom{t+3}{4}+\bigl(\binom{t+3}{3}-\binom{t+2}{3}\bigr)3(4t+3​)+((3t+3​)−(3t+2​)), and one more instance of Pascal gives (t+33)−(t+23)=(t+22)\binom{t+3}{3}-\binom{t+2}{3}=\binom{t+2}{2}(3t+3​)−(3t+2​)=(2t+2​).

Formalization Note The three counts of five-part compositions come from comps_card. Because all arithmetic stays in N\mathbb{N}N, the Pascal steps must be arranged so that no subtraction is truncated.

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

theorem sm3_params_card (t : ℕ) :
    sm3Count t = 3 * ((t + 3).choose 4) + ((t + 2).choose 2) := by sorry

end MagicSquares
Source
P. A. MacMahon, Combinatory Analysis (1915); M. Beck, T. Cohen, J. Cuomo, P. Gribelyuk, The number of "magic" squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707-717; arXiv:math/0201013v3, Section 2, Theorem 1.
Human review
  • Endorsed by Shuze Chen · Sep 17, 2026

  • Endorsed by Yuxuan Xu · Sep 17, 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