change value of Array elements at fix location as per rule ( n * n + 1 ) - arr [ i ] [ j ] Top Left corner of Matrix ( order ( n / 4 ) * ( n / 4 ) )
for ( $ i = 0 ; $ i < $ n / 4 ; $ i ++ ) for ( $ j = 0 ; $ j < $ n / 4 ; $ j ++ ) $ arr [ $ i ] [ $ j ] = ( $ n * $ n + 1 ) - $ arr [ $ i ] [ $ j ] ;