Application of the magic square algorithm