/Magic-Square-finder

Magic square finder & solver .

Primary LanguageJavaMIT LicenseMIT

Magic-Square-finder

alt tag

In recreational mathematics, a magic square is an arrangement of distinct numbers (i.e. each number is used once), usually integers, in a square grid, where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number. A magic square has the same number of rows as it has columns, and in conventional math notation, "n" stands for the number of rows (and columns) it has. Thus, a magic square always contains n2 numbers, and its size (the number of rows [and columns] it has) is described as being "of order n".[1] A magic square that contains the integers from 1 to n2 is called a normal magic square. (The term "magic square" is also sometimes used to refer to any of various types of word squares.)

Magic-square-finder identifies a n x n matrix if it is a Magical or not ?

#Usage

Clone or download the repository.

Open the .java file. Change the below lines to test your own NxN Matrix.

/* * You can enter any nxn matrix below line to check if it is a magic square or not. */

	int[][] matrix = { { x1, y1, z1, t1 }, { x2, y2, z2, t2 }, { x3, y3, z3, t3},
			{ x4, y4, z4, t4 } };