Tool to solve or generate Latin squares (generalization of sudoku). The Latin square is a square grid of size NxN comprising N distinct symbols distributed such that each row and column also have N distinct symbols.

Latin Square - dCode

Tag(s) : Number Games

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!

A suggestion ? a feedback ? a bug ? an idea ? *Write to dCode*!

Tool to solve or generate Latin squares (generalization of sudoku). The Latin square is a square grid of size NxN comprising N distinct symbols distributed such that each row and column also have N distinct symbols.

A **Latin square** is a square of size $ n \ times n $ filled with exactly $ n $ distinct symbols (letters, numbers, numbers) so that each symbol appears only once per line and per column.

__Example:__ A 3x3 **Latin square**:

1 | 2 | 3 |

3 | 1 | 2 |

2 | 3 | 1 |

There are several methods for generating **Latin squares**. Here is the shortest to explain:

1- Take an empty NxN grid,

__Example:__

- | - | - |

- | - | - |

- | - | - |

2- Fill the first line with N symbols

__Example:__

A | B | C |

- | - | - |

- | - | - |

3- Fill the next line by shifting all the symbols by 1 box to the right (and return to the beginning of the line if necessary)

__Example:__

A | B | C |

C | A | B |

- | - | - |

4- Repeat step 3 until you reach the last line of the grid.

__Example:__

A | B | C |

C | A | B |

B | C | A |

And voilà ! The square is thus valid but always identical, to obtain others:

5- Randomly swap 2 lines

6- Randomly swap 2 columns

7- Repeat steps 5 and 6 as many times as desired, the result is always a **Latin square**.

The resolution algorithm consists in noting, for each unfilled cell, the list of possible symbols respecting the rules (prohibition of 2 identical symbols on the same line or the same column), if only one symbol among the N is possible then fill in the cell with this symbol.

The **Latin square** name comes from Leonhard Euler who studied these grids and who used Latin letters as symbols.

The best known variant is sudoku, which uses the same bases, but adds a constraint on blocks of 3x3 (and sometimes other constraints for irregular sudoku).

Ken-ken (kendoku) is also a **Latin square** with constraints of mathematical calculations.

The magic square is a distant mathematical variant which takes up the fact that the sum of the rows and the columns is always identical, but it is not limited to N distinct symbols.

The first written traces of work on these grids date from 1700, but the principle itself was known long before.

dCode retains ownership of the source code of the script Latin Square online. Except explicit open source licence (indicated Creative Commons / free), any algorithm, applet, snippet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in any informatic langauge (PHP, Java, C#, Python, Javascript, Matlab, etc.) which dCode owns rights will not be released for free. To download the online Latin Square script for offline use on PC, iPhone or Android, ask for price quote on contact page !

Please, check our community Discord for help requests!

latin,square,sudoku,euler

Source : https://www.dcode.fr/latin-square

© 2020 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.

Feedback

▲