powered by
hudson(n = NULL, a = NULL, b = NULL)
NULL
a
c(n-1,0:(n-2))
c(2:(n-1),n,1)
b
Note that n is not checked for being in the form $6n\pm 1$. If it is not the correct form, the square is normal but not necessarily magic.
n
recurse
hudson(n=11) magicplot(hudson(n=11)) is.associative(hudson(n=13)) hudson(a=(2*1:13)%%13 , b=(8*1:13)%%13) all(replicate(10,is.magic(hudson(a=sample(13),b=sample(13)))))
Run the code above in your browser using DataLab