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

is.ok

does a vector have the sum required to be a row or column of a magic square?


Description

Returns TRUE if and only if sum(vec)==magic.constant(n,d=d))

Usage

is.ok(vec, n=length(vec), d=2)

Arguments

vec

Vector to be tested

n

Order of square or hypercube. Default assumes order is equal to length of vec

d

Dimension of square or hypercube. Default of 2 corresponds to a square

Author(s)

Robin K. S. Hankin

Examples

is.ok(magic(5)[1,])

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.