# N-adic numbers & magic squares (cubes)

### F. Poyo (yoshi.tamori@gmail.com)

The summation of a pair of numbers located in the pair of symmetrical places of N-adic number table is always N-1. For example, in decimal:
 0+9=9 pair {0,9} 1+8=9 pair {1,8} 2+7=9 pair {2,7} 3+6=9 pair {3,6} 4+5=9 pair {4,5}
as well in 4-adic:
 0+3=3 pair {0,3} 1+1=3 pair {1,2}.
We use this characterisitic in the following text. In 4-adic, we can put numbers as sets (0,1,2,3), (0,0,3,3) and (1,1,2,2) could exist in column, row, diagonal vectors. For example,

where {m} means that m is the 4-adic expression. As well, we define [m] which explicitly means that m is decimal expression. With these expression,

{12}=[6]

In the above matrix, the summation of the elements of any column, row and diagonal vectors has a unique value {12}. We call this characteristic of a matrices "Magic square condition".

# Magic square condition:

```      "The summation of the elements of any column, row
and diagonal vectors has a unique value."
```

We prepare a dozen of such matrices and name them by A0,A1,A2,B0,B1,B2,C0,C1,C2,D0,D1,D2. With the dozen matrices, we make four matrices A,B,C,D whoes elements are four-figure 4-adic numbers as follows:

A = A242 + A141 + A040 = 16A2 + 4A1 + A0
B = B242 + B141 + B040 = 16B2 + 4B1 + B0
C = C242 + C141 + C040 = 16C2 + 4C1 + C0
D = D242 + D141 + D040 = 16D2 + 4D1 + D0

For these combined matrices, the "magic square condition" (for An, Bn, Cn, Dn) is conserved (satisfied by A,B,C,D). If we choose the dozen 4-adic matrices An,Bn,Cn,Dn (n=0,1,2) very carefully, we can obtain a magic cube. The following is the concrete example. All elements are expressed by 4-adic numbers. For example, you can choose the matrix which has only numbers in a place of {100} in 4-adic. In the columns, row, diagonal vectors of the choosen matrix, one of (0,1,2,3), (0,0,3,3), (1,1,2,2) appears.
 000 331 332 003 223 112 111 220 113 222 221 110 330 001 002 333
 323 012 011 320 100 231 232 103 230 101 102 233 013 322 321 010
 313 022 021 310 130 201 202 133 200 131 130 203 023 312 311 020
 030 301 302 033 213 122 121 210 123 212 211 120 300 031 032 303
Since we can too-easily convert the above matirices into decimal expressions, I do not show it. This method can be extended toward general cases (N magic cubes).