N is an odd number, f (n) = (1+2+3+...+N2)/n = ((1+N2)/2) × N2)/n = (1+N2).
N is an even number, f (n) = (1+2+3+...+n 2)/n = (1+n 2) × (n 2)/n = (1+n 2).
So regardless of parity, f (n) = (1+n 2) n/2.
f(3)=( 1+3^2)×3/2=( 1+9)×3/2= 15
f(4)=( 1+4^2)×4/2=( 1+ 16)×4/2=34
The simplest method of the fourth-order magic square is as follows: