Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Get a magic square for any dimension
ResourceFunction["MagicSquare"][n] gives a magic square of dimension n. |
Generate a 6×6 magic square:
In[2]:= |
Out[2]= |
An 8×8 magic square:
In[3]:= |
Out[3]= |
Visualize the sums within a 5×5 magic square:
In[4]:= |
Out[4]= |
Check that the row, column, main diagonal and antidiagonal sums all agree, and are equal to the magic constant:
In[5]:= |
Out[5]= |
In[6]:= |
Out[6]= |
In[7]:= |
Out[7]= |
In[8]:= |
Out[8]= |
In[9]:= |
Out[9]= |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License