hudson: Pandiagonal magic squares due to Hudson

hudsonR Documentation

Pandiagonal magic squares due to Hudson

Description

Returns a regular pandiagonal magic square of order 6m\pm 1 using a method developed by Hudson.

Usage

hudson(n = NULL, a = NULL, b = NULL)

Arguments

n

Order of the square, n=6m\pm 1. If NULL, use the length of a

a

The first line of Hudson's A matrix. If NULL, use Hudson's value of c(n-1,0:(n-2))

b

The first line of Hudson's B matrix. If NULL, use Hudson's value of c(2:(n-1),n,1). Using default values for a and b gives an associative square

Details

Returns one member of a set of regular magic squares of order n=6m\pm 1. The set is of size (n!)^2.

Note that n is not checked for being in the form 6n\pm 1. If it is not the correct form, the square is magic but not necessarily normal.

Author(s)

Robin K. S. Hankin

References

C. B. Hudson, On pandiagonal squares of order 6t +/- 1, Mathematics Magazine, March 1972, pp94-96

See Also

recurse

Examples

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)))))

RobinHankin/magic documentation built on Jan. 17, 2024, 8:36 p.m.