Explore BrainMass
Share

Explore BrainMass

    Magic Matrix

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Magic matrix
    A N*N matrix is called a magic matrix if it is filled with numbers in {1.. N^2} and sum of the values in all rows, columns are equal.

    Supposing an odd N, we are planing to describe how to create such a matrix.
    Example of such a matrix is as following:

    © BrainMass Inc. brainmass.com June 1, 2020, 5:15 pm ad1c9bdddf
    https://brainmass.com/computer-science/algorithms/magic-matrix-numbers-133093

    Solution Preview

    Select an arbitary cell in matrix ad start with 1.
    | |
    | |
    | 1 |

    cell (i,j)=(3,1) is selected. The next number will be placed in the cell (i-1) and(j-1). If this cell is out of bound, i.e

    if i-1 <0 then i=N
    if j-1 < 0 ...

    Solution Summary

    A comprehensive step by step agorithm tries to show how to create a N*N magic matrix for odd values of N.

    $2.19

    ADVERTISEMENT