28 July 2025

The magic square of 1/19

Introduction


For 1/19 as generator of the 18x18 magic square


 see here. The 18 rows, 18 columns and 2 diagonals all add up to 81. Each row and each column contains one 0 and one 9, and each other digit twice. In this post we implement this magic square, coloured, in GeoGebra.


The colour code for the digits can be deduced from the first column, whose successive colours represent 0,1,2,3,4,5,6,7,8,9, Each row and each column contains one red and one black square, and each other colour twice.

The digits


The digits of 1/19 can be obtained from the On-line Encyclopedia of Integer Sequences (here). The first 18 digits of 1/19 are endlessly repeated, and its multiples 2/19,...,18/19 have the same period. The lists below give the first periods of 1/19 up to 18/19. They can be obtained (though not in order) by rotating the digits in the first list.
  • digits01 = {0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1}
  • digits02 = {1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2}
  • digits03 = {1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3}
  • digits04 = {2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4}
  • digits05 = {2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5}
  • digits06 = {3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6}
  • digits07 = {3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7}
  • digits08 = {4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8}
  • digits09 = {4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9}
  • digits10 = {5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0}
  • digits11 = {5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1}
  • digits12 = {6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2}
  • digits13 = {6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3}
  • digits14 = {7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4}
  • digits15 = {7, 8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5}
  • digits16 = {8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8, 9, 4, 7, 3, 6}
  • digits17 = {8, 9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7}
  • digits18 = {9, 4, 7, 3, 6, 8, 4, 2, 1, 0, 5, 2, 6, 3, 1, 5, 7, 8}

The list of all 324 digits {0, 5, 2, ..., 5, 7, 8}, from the first in digits01 to the last in digits18, is obtained in digits below.

  • digits00={digits01, digits02, digits03, digits04, digits05, digits06, digits07, digits08,d igits09,d igits10, digits11, digits12, digits13, digits14, digits15, digits16, digits17, digits18}
  • digits=flatten(digits00)

The squares


coor is the list of coordinates (1,18), (2,18), ..., (18,18), (1,17), ..., (18,1), i.e., row after row, from top to bottom.

  • to18=Sequence(18)
  • h01=(to18, 1) etc h18=(to18, 18)
  • coor00={h18, h17, h16, h15, h14, h13, h12, h11, h10, h09, h08, h07, h06, h05, h04, h03, h02, h01}
  • coor=flatten(coor00)

squares is the list of the 324 unit squares centered at the coordinates in coor.

  • coorlu=coor + (-0.5, -0.5)
  • coorru=coor + (0.5, -0.5)
  • squares=Sequence(Polygon(coorlu(k), coorru(k), 4), k, 1, 18 * 18)


squares and coor

Squares coloured per digit


The list is0 is {1, 20, 50, ..., 316}, consisting of the numbers k among {1, 2, 3, ..., 324} such that digits(k) is 0, and squares0 consists of the squares containing a 0. 

  • is0=KeepIf(digits(k) ≟ 0, k, 18*18) 
  • squares0=Sequence(squares(is0(k)), k, 1, Length(is0))

Doing the same for 1,2,...,9 one obtains the ten-colour square shown above. To separate the squares, a black grid has been added:

  • hori=Sequence(Segment((0.5, k - 0.5), (18.5, k - 0.5)), k, 1, 19)
  • verti=Sequence(Segment((k - 0.5, 0.5), (k - 0.5, 18.5)), k, 1, 19)