magic_rectangle(p, q) constructs a magic rectangle (p,
q of equal parity; De Los Reyes et al. 2009 for even orders,
Chai-Das-Midha 2013 for odd orders) or a nearly magic rectangle
(opposite parity; Chai-Singh-Stufken
rectangle_type(p, q) classifies existence (“magic”,
“nearly magic”, “none”).verify_rectangle(M) checks the defining properties from
first principles.