5 Years ago, this happened, and then it became sort of a meme.
Challenge
The Challenge today is, to check if a "magic square" is a valid parker square.
What is a Real Magic square?
- All the numbers must be natural or sometimes 0
- The sum of rows, columns and diagonals must be same.
- There must be no repeating numbers
What Matt tried to achieve is a real magic square but with all the numbers being squares.
But what he did is a semi-magic square, sometimes called The Parker Square.
What is a valid parker square (rules made by me)?
- It must be a \$3\times3\$ "magic square"
- There must be at least one number that appear twice in the square
- The rows and columns must add up to the same number
- At least one diagonal must add up to the same number too.
- Each number must be the square of an integer
Rules
- Input must be given in a form of a list (flat or 2-dimensional), or just 9 inputs from top left to bottom right
- Input is guaranteed to represent a \$3×3\$ square
- Output must be a Boolean, 1 or 0, no output or some output
- Standard Loopholes apply
- This is code-golf, so the shortest code in each language wins!
Examples
Classic Parker Square:
In: [841, 1, 2209, 1681, 1369, 1, 529, 1681, 841]
Out: True
0-Square
In: [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
Out: 1
Mirrored Square:
In: 4, 9, 1, 9, 1, 9, 1, 9, 4
Out: 0
Random Square:
In: 1, 2, 4, 3, 4, 9, 8, 9, 0
Out: False
Real Magic Square:
In: [[8, 1, 6], [3, 5, 7], [4, 9, 2]]
Out:
Pythagorean triple (by Arnauld):
In: [25, 0, 0, 0, 16, 9, 0, 9, 16]
Out: false
Non integer (Suggested by Luis):
In: [841.45, 1, 2209, 1681, 1369, 1, -529, 1681, 841]
Out: false
Almost real magic square of squares (Suggested by Jonathan):
In: [[16129, 2116, 3364], [4, 12769, 8836], [5476, 6724, 9409]]
Out: 0
Disclaimer: I put magic square in quotes, because most people don't think it is a magic square if the numbers repeat. But it doesn't mean it is easy to make a "magic square" with only a few numbers repeating, all squares and on of the diagonals working. Good work Matt!