hudson | R Documentation |
Returns a regular pandiagonal magic square of order 6m+/-1 using a method developed by Hudson.
hudson(n = NULL, a = NULL, b = NULL)
n |
Order of the square, n=6m+/-1. If
|
a |
The first line of Hudson's A matrix. If
|
b |
The first line of Hudson's B matrix. If
|
Returns one member of a set of regular magic squares of order n=6m+/-1. The set is of size (n!)^2.
Note that n
is not checked for being in the form 6n+1/6n-1. If it is not the correct form, the square is magic
but not necessarily normal.
Robin K. S. Hankin
C. B. Hudson, On pandiagonal squares of order 6t +/- 1, Mathematics Magazine, March 1972, pp94-96
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)))))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.