magic.2np1 | R Documentation |
Function to create magic squares of odd order
magic.2np1(m, ord.vec = c(-1, 1), break.vec = c(1, 0), start.point=NULL)
m |
creates a magic square of order n=2m+1 |
ord.vec |
ordinary vector. Default value of |
break.vec |
break vector. Default of |
start.point |
Starting position for the method (ie coordinates of
unity). Default value of NULL corresponds to row 1, column |
Robin K. S. Hankin
Written up in loads of places. The method (at least with the default ordinary and break vectors) seems to have been known since at least the Renaissance.
Benson and Jacoby, and the Mathematica website, discuss the problem with nondefault ordinary and break vectors.
magic
, magic.prime
magic.2np1(1) f <- function(n){is.magic(magic.2np1(n))} all(sapply(1:20,f)) is.panmagic(magic.2np1(5,ord.vec=c(2,1),break.vec=c(1,3)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.