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

magic.product

Product of two magic squares


Description

Gives a magic square that is a product of two magic squares.

Usage

magic.product(a, b, mat=NULL)
magic.product.fast(a, b)

Arguments

a

First magic square; if a is an integer, use magic(a).

b

as above

mat

Matrix, of same size as a, of integers treated as modulo 8. Default value of NULL equivalent to passing a*0. Each number from 0-7 corresponds to one of the 8 squares which have the same Frenicle's standard form, as generated by transf(). Then subsquares of the product square (ie tiles of the same size as b) are rotated and transposed appropriately according to their corresponding entry in mat. This is a lot easier to see than to describe (see examples section).

Details

Function magic.product.fast() does not take a mat argument, and is equivalent to magic.product() with mat taking the default value of NULL. The improvement in speed is doubtful unless order(a)>>order(b), in which case there appears to be a substantial saving.

Author(s)

Robin K. S. Hankin

References

William H. Benson and Oswald Jacoby. New recreations with magic squares, Dover 1976 (and that paper in JRM)

Examples

magic.product(magic(3),magic(4))
magic.product(3,4)

mat <- matrix(0,3,3)
a <- magic.product(3,4,mat=mat)
mat[1,1] <- 1
b <- magic.product(3,4,mat=mat)

a==b

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.