magicrect: Construct Magic Rectangles and Nearly Magic Rectangles

Constructs a magic rectangle or a nearly magic rectangle of order p x q for every order for which one exists, together with existence classification and verification utilities. A magic rectangle arranges the integers 1 to p*q so that all row sums are equal and all column sums are equal; it exists exactly when p and q have the same parity, excluding 2 x 2 and degenerate single-row/column cases (Hagedorn, 1999, <doi:10.1016/S0012-365X(99)00041-2>). When p and q have opposite parity a nearly magic rectangle exists instead, with constant sums along one direction and sums differing by at most one along the other (Chai, Singh and Stufken, 2019, Journal of Combinatorial Designs 27(6), 368-376). Implements the constructions of De Los Reyes, Das, Midha and Vellaisamy (2009) for even by even orders, Chai, Das and Midha (2013) for odd by odd orders, and Chai, Singh and Stufken (2019) for the nearly magic (even by odd) case.

Version: 1.0.0
Published: 2026-07-19
DOI: 10.32614/CRAN.package.magicrect
Author: Arijit Ray [aut, cre]
Maintainer: Arijit Ray <ray.asokekumar at gmail.com>
BugReports: https://github.com/Arijitray2/magic-rectangles/issues
License: MIT + file LICENSE
URL: https://github.com/Arijitray2/magic-rectangles, https://arijitray2.github.io/magic-rectangles/
NeedsCompilation: no
Materials: README, NEWS
CRAN checks: magicrect results

Documentation:

Reference manual: magicrect.html , magicrect.pdf

Downloads:

Package source: magicrect_1.0.0.tar.gz
Windows binaries: r-devel: magicrect_1.0.0.zip, r-release: magicrect_1.0.0.zip, r-oldrel: magicrect_1.0.0.zip
macOS binaries: r-release (arm64): magicrect_1.0.0.tgz, r-oldrel (arm64): magicrect_1.0.0.tgz, r-release (x86_64): magicrect_1.0.0.tgz, r-oldrel (x86_64): magicrect_1.0.0.tgz

Linking:

Please use the canonical form https://CRAN.R-project.org/package=magicrect to link to this page.