Modular arithmetic of mancala games → Portuguese.

The connection between mancala games and modular arithmetic (also known as clock arithmetic) is that, in most games, seeds are distributed along a closed path (ie. a path with the same first and last vertex). Modular arithmetic is most useful, when it is important to know where the last seed is sown. It works best in single-lap games.

## Examples

Each pit is represented by an integer and numbers "wrap around" after the sowing reaches the emptied pit again. The modulus n is defined by the number of pits that form the closed path of distribution. If, for instance, the game is played on a 2 x 4 board and the original pit isn't skipped, the modulus is 8 and 3 is congruent to 11, 19, 27 and so on, because the remainder is for each dividend 3 after it was divided by 8. The quotient gives the number of cycles.

The following formulae are used to determine the pit, which receives the last seed of a sowing:

### Vai Lung Thlan

• Board: 2 rows x 6 pits.
• First seed is sown in the next pit.
• Emptied hole isn't skipped.
(e + s mod12) mod12 = d

### Oware

• Board: 2 rows x 6 pits.
• First seed is sown in the next pit.
• Emptied hole is skipped.
If s < 12:
(e + s mod12) mod12 = d
If s > 11:
(e + (s + 1) mod12) mod12 = d

### Cross-Wari

• Board: 2 rows x 6 pits.
• First seed is sown in the next pit.
• Emptied hole is skipped.
If s < 12 and even:
(e + s mod12) mod12 = d
If s < 12 and odd:
(e-s mod12) mod12 = d
If s > 11 and even:
(e + (s + 1) mod12) mod12 = d
If s > 11 and odd:
(e - (s + 1) mod12) mod12 = d

### Toguz Kumalak

• Board: 2 rows x 9 pits.
• First seed is sown in the emptied pit unless it is a singleton, which is dropped into the next pit.
• Emptied hole isn't skipped.
If s = 1:
e + 1 = d
If s > 1:
(e + (s-1) mod18) mod18 = d

The following formula is used to determine how many seeds a pit must contain to reach the player's store with the last seed:

### Kalah

• Board: 2 rows x 6 pits + 1 functional endhole for each player at his right.
• First seed is sown in the next pit (or the player's store).
• Emptied hole isn't skipped.
s = (7 - e) mod13

### Variables

e: emptied pit
d: destination pit
s: seeds in the emptied pit