Nothing
#' Verify magic square properties
#'
#' @param M Square matrix
#'
#' @return TRUE if M satisfies the magic square condition
#' @export
#'
#' @examples
#' M=YangConway(m = 2, d_type = "unit", template_set = 1)
#' is_magic_square(M)
is_magic_square <- function(M) {
n <- nrow(M)
target <- n * (n^2 + 1) / 2
all(rowSums(M) == target) &&
all(colSums(M) == target) &&
sum(diag(M)) == target &&
sum(diag(M[, n:1])) == target
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.