Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sam

Sparse antimagic squares


Description

Produces an antimagic square of order m using Gray and MacDougall's method.

Usage

sam(m, u, A=NULL, B=A)

Arguments

m

Order of the magic square (not “n”: the terminology follows Gray and MacDougall)

u

See details section

A,B

Start latin squares, with default NULL meaning to use circulant(m)

Details

In Gray's terminology, sam(m,n) produces a SAM(2m,2u+1,0).

The method is not vectorized.

To test for these properties, use functions such as is.antimagic(), documented under is.magic.Rd.

Author(s)

Robin K. S. Hankin

References

I. D. Gray and J. A. MacDougall 2006. “Sparse anti-magic squares and vertex-magic labelings of bipartite graphs”, Discrete Mathematics, volume 306, pp2878-2892

See Also

Examples

sam(6,2)

jj <- matrix(c(
     5, 2, 3, 4, 1,
     3, 5, 4, 1, 2,
     2, 3, 1, 5, 4,
     4, 1, 2, 3, 5, 
     1, 4, 5, 2, 3),5,5)

is.sam(sam(5,2,B=jj))

magic

Create and Investigate Magic Squares

v1.5-9
GPL-2
Authors
Robin K. S. Hankin
Initial release
2018-09-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.