# magic v1.5-9

0

0th

Percentile

## Create and Investigate Magic Squares

A collection of efficient, vectorized algorithms for the creation and investigation of magic squares and hypercubes, including a variety of functions for the manipulation and analysis of arbitrarily dimensioned arrays. The package includes methods for creating normal magic squares of any order greater than 2. The ultimate intention is for the package to be a computerized embodiment all magic square knowledge, including direct numerical verification of properties of magic squares (such as recent results on the determinant of odd-ordered semimagic squares). Some antimagic functionality is included. The package also serves as a rebuttal to the often-heard comment "I thought R was just for statistics".

## Functions in magic

 Name Description circulant Circulant matrices of any order arow Generalized row and col adiag Binds arrays corner-to-corner magic.constant Magic constant of a magic square or hypercube magic-package Magic squares and hypercubes; arbitrary dimensioned array manipulation hudson Pandiagonal magic squares due to Hudson magichypercube.4n Magic hypercubes of order 4n is.magic Various tests for the magicness of a square fnsd First non-singleton dimension cilleruelo A class of multiplicative magic squares due to Cilleruelo and Luca magicplot Joins consecutive numbers of a magic square. magic.4np2 Magic squares of order 4n+2 magic.2np1 Magic squares of odd order lozenge Conway's lozenge algorithm for magic squares magic.4n Magic squares of order 4n magic.prime Magic squares prime order diag.off Extracts broken diagonals magic.product Product of two magic squares minmax are all elements of a vector identical? force.integer Integerize array elements notmagic.2n An unmagic square process Force index arrays into range is.square.palindromic Is a square matrix square palindromic? as.standard Standard form for magic squares transf Frenicle's equivalent magic squares latin Random latin squares hadamard Hadamard matrices hendricks A perfect magic cube due to Hendricks allsubhypercubes Subhypercubes of magic hypercubes magic Creates magic squares perfectcube6 A perfect cube of order 6 recurse Recursively apply a permutation perfectcube5 A perfect magic cube of order 5 sam Sparse antimagic squares do.index Apply a function to array element indices eq Comparison of two magic squares magiccube.2np1 Magic cubes of order 2n+1 shift Shift origin of arrays and vectors magiccubes Magic cubes of order 3 is.magichypercube magic hypercubes is.ok does a vector have the sum required to be a row or column of a magic square? nqueens N queens problem panmagic.4 Panmagic squares of order 4 panmagic.6npm1 Panmagic squares of order 4n, 6n+1 and 6n-1 strachey Strachey's algorithm for magic squares panmagic.8 Panmagic squares of order 8 subsums Sums of submatrices magic.8 Regular magic squares of order 8 allsums Row, column, and two diagonal sums of arrays apad Pad arrays arev Reverses some dimensions; a generalization of rev arot Rotates an array about two specified dimensions Frankenstein A perfect magic cube due to Frankenstein apl Replacements for APL functions take and drop aplus Generalized array addition Ollerenshaw A most perfect square due to Ollerenshaw cube2 A pantriagonal magic cube No Results!