I'm actually not sure it's possible. I suspect if a solution exists, it's purely arithmetic.
So the content of any cell will be from this set 0123456789+-*/ ~!%^|&.
I tried for several hours without success.
The main problem is that for the last column (or row) to have any meaningful calculation, one of the rows (or columns) leading to it ...
05AB1E, 4x4 5x5
Try it online. (Loops over the rows; columns; main diagonal; and main anti-diagonal of the square, and will run it was 05AB1E code with .V, after which it discards everything that remains on the stack for the next iteration with )\.)
The w are no-ops, so I'll ignore them in the explanations ...
Keg, 4x4 magic square
Try it online!
0601 - 1
7.92 - 7
3._. - 3
8654 - 4
I can't believe this actually works! Programs need the -hr flag to properly output the required result.
Test suite. Uncomment each line to run it. The -in flag is purely to make the test suite a nicer experience, as otherwise, the ...