# modify a magic square - part II

This is a 4x4 magic square of multiplication,
in which product of each row, column, and diagonal are equal.

$\begin{bmatrix}2 & 15 & 50 & 18\\ 9& 30& 4& 25\\ 20& 5& 45& 6\\ 75& 12& 3& 10\end{bmatrix}$

Now modify the magic square by defining a simple algorithm $f(x)$,
so it becomes a new magic square of addition,
in which sum of each row, column, and diagonal are equal.

$\begin{bmatrix}f(2) & f(15) & f(50) & f(18)\\ f(9) & f(30)& f(4)& f(25)\\ f(20)& f(5)& f(45)& f(6)\\ f(75)& f(12)& f(3)& f(10)\end{bmatrix}$

Note:

• The algorithm works to every magic square of multiplication.
• The numbers in the new magic square must be integers
• some numbers in the new magic square can be equal, but not all
• Avoid using $f(x) = C$
• $f(x)=\log x$?­ – f'' Aug 23 '16 at 2:33
• @f'' Maybe it works, but the resulting numbers are not integers – Jamal Senjaya Aug 23 '16 at 2:36

Almost fully general:

$$f(n):= \sum_{p \text{ prime}} \prod_{k=1}^\infty [p^k | n] 10^{P(k) - 1}$$

where $P(k)$ represents the $k$th prime number and $[\cdot]$ are the Iverson brackets.

In a more reasonably expressed way, this turns every factor of $2$ into a $+1$, every factor of $3$ into a $+10$, every factor of $5$ into a $+100$... Since there are no powers greater than or equal to $10$, we don't have to worry about "carrying".

(This could be modified to make it fully general by replacing $10$ with $\max(M)$, where $M$ is the magic square itself.)

This turns it into:

$\begin{bmatrix}001 & 110 & 201 & 021\\ 020& 111& 002& 200\\ 102& 100& 110& 011\\ 210& 012& 010& 101\end{bmatrix}$

(These numbers are in base $10$ if you use the first formula, and base $75$ if you use the modified version. I've kept leading zeroes to more clearly show the patterns.)

An easier one:

$f(n)$ is the number of times 2 divides $n$.

This pretty much does the same thing as the one above, but since numbers can be different we don't have to worry about collisions. So we can simplify it by truncating everything but the last digit.

This turns it into:

$\begin{bmatrix}1 & 0 & 1 & 1\\ 0& 1& 2& 0\\ 2& 0& 0& 1\\ 0& 2& 0& 1\end{bmatrix}$

Deusovi has answered the puzzle correctly, This is my version :

Replace each number with its prime factors
Do this to all numbers in the magic square
Than (add the numbers) to create a new magic square

example :

$\begin{bmatrix}2 & 15 & 50 & 18\\ 9& 30& 4& 25\\ 20& 5& 45& 6\\ 75& 12& 3& 10\end{bmatrix}$

into

$\begin{bmatrix}  & [3,5] & [2,5,5] & [2,3,3]\\ [3,3] & [2,3,5] & [2,2] & [5,5]\\ [2,2,5]&  & [3,3,5] & [2,3]\\ [3,5,5] & [2,2,3] &  & [2,5] \end{bmatrix}$

then add the numbers inside the matrix

$\begin{bmatrix} 2 & 8 & 12 & 8\\ 6 & 10 & 4 & 10\\ 9 & 5 & 11 & 5\\ 13 & 7 & 3 & 7\end{bmatrix}$

or you can replace each prime factors with symbols,
and you can replace the symbol with any numbers, before adding it.
you can try some combinations of numbers to make each number unique

$\begin{bmatrix} [A] & [B,C] & [A,C,C] & [A,B,B]\\ [B,B] & [A,B,C] & [A,A] & [C,C]\\ [A,A,C]& [C] & [B,B,C] & [A,B]\\ [B,C,C] & [A,A,B] & [B] & [A,C] \end{bmatrix}$