Place 9 non-zero digits into the squares of a 3x3 chessboard so that any 2 consecutive digits share a common side of 2 neighboring squares.
In how many ways can this task be achieved?
To make the program not a complete waste of resources, the 4x4 case is shown below, but since there are 552 solutions counting 483 that are rotations or reflections of previous others, only the first of each of the 69 types is shown:
1 2 3 4
8 7 6 5
9 10 11 12
16 15 14 13
1 2 3 4
8 7 6 5
9 12 13 14
10 11 16 15
1 2 3 4
8 7 6 5
9 12 13 16
10 11 14 15
1 2 3 4
8 7 6 5
9 16 15 14
10 11 12 13
1 2 3 4
16 7 6 5
15 8 9 10
14 13 12 11
1 2 3 4
10 9 6 5
11 8 7 16
12 13 14 15
1 2 3 4
14 13 6 5
15 12 7 8
16 11 10 9
1 2 3 4
14 15 6 5
13 16 7 8
12 11 10 9
1 2 3 4
16 15 6 5
13 14 7 8
12 11 10 9
1 2 3 4
12 11 10 5
13 14 9 6
16 15 8 7
1 2 3 4
12 11 10 5
13 16 9 6
14 15 8 7
1 2 3 4
16 11 10 5
15 12 9 6
14 13 8 7
1 2 3 4
14 15 16 5
13 10 9 6
12 11 8 7
1 2 3 4
14 13 12 5
15 10 11 6
16 9 8 7
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
1 2 3 4
12 13 16 5
11 14 15 6
10 9 8 7
1 2 3 4
16 15 14 5
11 12 13 6
10 9 8 7
1 2 3 16
6 5 4 15
7 10 11 14
8 9 12 13
1 2 3 16
8 7 4 15
9 6 5 14
10 11 12 13
1 2 9 10
4 3 8 11
5 6 7 12
16 15 14 13
1 2 11 12
4 3 10 13
5 8 9 14
6 7 16 15
1 2 15 14
4 3 16 13
5 8 9 12
6 7 10 11
1 2 15 16
4 3 14 13
5 8 9 12
6 7 10 11
1 2 13 12
4 3 14 11
5 16 15 10
6 7 8 9
1 2 5 6
16 3 4 7
15 12 11 8
14 13 10 9
1 2 7 8
16 3 6 9
15 4 5 10
14 13 12 11
2 1 6 7
3 4 5 8
12 11 10 9
13 14 15 16
2 1 6 7
3 4 5 8
14 13 12 9
15 16 11 10
2 1 6 7
3 4 5 8
16 13 12 9
15 14 11 10
2 1 6 7
3 4 5 8
14 15 16 9
13 12 11 10
2 1 16 15
3 4 5 14
8 7 6 13
9 10 11 12
2 1 12 13
3 4 11 14
6 5 10 15
7 8 9 16
2 1 14 13
3 4 15 12
6 5 16 11
7 8 9 10
2 1 14 15
3 4 13 16
6 5 12 11
7 8 9 10
2 1 16 15
3 4 13 14
6 5 12 11
7 8 9 10
2 1 8 9
3 4 7 10
16 5 6 11
15 14 13 12
2 1 10 11
3 8 9 12
4 7 14 13
5 6 15 16
2 1 10 11
3 8 9 12
4 7 16 13
5 6 15 14
2 1 16 15
3 8 9 14
4 7 10 13
5 6 11 12
2 1 14 13
3 16 15 12
4 7 8 11
5 6 9 10
2 1 12 13
3 10 11 14
4 9 8 15
5 6 7 16
2 1 12 11
3 14 13 10
4 15 16 9
5 6 7 8
2 1 12 11
3 16 13 10
4 15 14 9
5 6 7 8
2 1 14 15
3 12 13 16
4 11 10 9
5 6 7 8
2 1 16 15
3 12 13 14
4 11 10 9
5 6 7 8
16 1 2 3
15 6 5 4
14 7 8 9
13 12 11 10
16 1 2 3
15 14 5 4
12 13 6 7
11 10 9 8
16 1 2 3
15 10 9 4
14 11 8 5
13 12 7 6
16 1 2 3
15 14 13 4
10 11 12 5
9 8 7 6
16 1 4 5
15 2 3 6
14 11 10 7
13 12 9 8
16 1 6 7
15 2 5 8
14 3 4 9
13 12 11 10
3 2 9 10
4 1 8 11
5 6 7 12
16 15 14 13
3 2 11 12
4 1 10 13
5 8 9 14
6 7 16 15
3 2 15 14
4 1 16 13
5 8 9 12
6 7 10 11
3 2 15 16
4 1 14 13
5 8 9 12
6 7 10 11
3 2 13 12
4 1 14 11
5 16 15 10
6 7 8 9
5 4 3 16
6 1 2 15
7 10 11 14
8 9 12 13
15 16 3 4
14 1 2 5
13 10 9 6
12 11 8 7
7 6 5 4
8 1 2 3
9 10 11 12
16 15 14 13
7 6 5 4
8 1 2 3
9 12 13 14
10 11 16 15
7 6 5 4
8 1 2 3
9 12 13 16
10 11 14 15
7 6 5 4
8 1 2 3
9 16 15 14
10 11 12 13
13 14 15 16
12 1 2 3
11 8 7 4
10 9 6 5
7 8 9 10
6 1 2 11
5 4 3 12
16 15 14 13
15 14 13 12
16 1 2 11
5 4 3 10
6 7 8 9
9 10 11 12
8 1 2 13
7 4 3 14
6 5 16 15
13 12 11 10
14 1 2 9
15 4 3 8
16 5 6 7
11 10 9 8
12 1 2 7
13 14 3 6
16 15 4 5
11 10 9 8
12 1 2 7
13 16 3 6
14 15 4 5
552 483 69
Eliminating backwards paths reduces this to 59:
1 2 3 4
8 7 6 5
9 10 11 12
16 15 14 13
1 2 3 4
8 7 6 5
9 12 13 14
10 11 16 15
1 2 3 4
8 7 6 5
9 12 13 16
10 11 14 15
1 2 3 4
8 7 6 5
9 16 15 14
10 11 12 13
1 2 3 4
16 7 6 5
15 8 9 10
14 13 12 11
1 2 3 4
10 9 6 5
11 8 7 16
12 13 14 15
1 2 3 4
14 13 6 5
15 12 7 8
16 11 10 9
1 2 3 4
14 15 6 5
13 16 7 8
12 11 10 9
1 2 3 4
16 15 6 5
13 14 7 8
12 11 10 9
1 2 3 4
12 11 10 5
13 14 9 6
16 15 8 7
1 2 3 4
12 11 10 5
13 16 9 6
14 15 8 7
1 2 3 4
16 11 10 5
15 12 9 6
14 13 8 7
1 2 3 4
14 15 16 5
13 10 9 6
12 11 8 7
1 2 3 4
14 13 12 5
15 10 11 6
16 9 8 7
1 2 3 4
12 13 14 5
11 16 15 6
10 9 8 7
1 2 3 4
12 13 16 5
11 14 15 6
10 9 8 7
1 2 3 4
16 15 14 5
11 12 13 6
10 9 8 7
1 2 3 16
6 5 4 15
7 10 11 14
8 9 12 13
1 2 3 16
8 7 4 15
9 6 5 14
10 11 12 13
1 2 11 12
4 3 10 13
5 8 9 14
6 7 16 15
1 2 15 14
4 3 16 13
5 8 9 12
6 7 10 11
1 2 15 16
4 3 14 13
5 8 9 12
6 7 10 11
1 2 13 12
4 3 14 11
5 16 15 10
6 7 8 9
1 2 5 6
16 3 4 7
15 12 11 8
14 13 10 9
1 2 7 8
16 3 6 9
15 4 5 10
14 13 12 11
2 1 6 7
3 4 5 8
12 11 10 9
13 14 15 16
2 1 6 7
3 4 5 8
14 13 12 9
15 16 11 10
2 1 6 7
3 4 5 8
16 13 12 9
15 14 11 10
2 1 6 7
3 4 5 8
14 15 16 9
13 12 11 10
2 1 16 15
3 4 5 14
8 7 6 13
9 10 11 12
2 1 12 13
3 4 11 14
6 5 10 15
7 8 9 16
2 1 14 13
3 4 15 12
6 5 16 11
7 8 9 10
2 1 14 15
3 4 13 16
6 5 12 11
7 8 9 10
2 1 16 15
3 4 13 14
6 5 12 11
7 8 9 10
2 1 8 9
3 4 7 10
16 5 6 11
15 14 13 12
2 1 10 11
3 8 9 12
4 7 14 13
5 6 15 16
2 1 10 11
3 8 9 12
4 7 16 13
5 6 15 14
2 1 16 15
3 8 9 14
4 7 10 13
5 6 11 12
2 1 14 13
3 16 15 12
4 7 8 11
5 6 9 10
2 1 12 13
3 10 11 14
4 9 8 15
5 6 7 16
2 1 12 11
3 14 13 10
4 15 16 9
5 6 7 8
2 1 12 11
3 16 13 10
4 15 14 9
5 6 7 8
2 1 14 15
3 12 13 16
4 11 10 9
5 6 7 8
2 1 16 15
3 12 13 14
4 11 10 9
5 6 7 8
16 1 2 3
15 6 5 4
14 7 8 9
13 12 11 10
16 1 2 3
15 14 5 4
12 13 6 7
11 10 9 8
16 1 2 3
15 10 9 4
14 11 8 5
13 12 7 6
16 1 2 3
15 14 13 4
10 11 12 5
9 8 7 6
16 1 4 5
15 2 3 6
14 11 10 7
13 12 9 8
16 1 6 7
15 2 5 8
14 3 4 9
13 12 11 10
3 2 15 14
4 1 16 13
5 8 9 12
6 7 10 11
3 2 15 16
4 1 14 13
5 8 9 12
6 7 10 11
3 2 13 12
4 1 14 11
5 16 15 10
6 7 8 9
5 4 3 16
6 1 2 15
7 10 11 14
8 9 12 13
15 16 3 4
14 1 2 5
13 10 9 6
12 11 8 7
7 6 5 4
8 1 2 3
9 12 13 16
10 11 14 15
7 6 5 4
8 1 2 3
9 16 15 14
10 11 12 13
13 14 15 16
12 1 2 3
11 8 7 4
10 9 6 5
15 14 13 12
16 1 2 11
5 4 3 10
6 7 8 9
Edited on June 24, 2021, 3:59 pm
|
Posted by Charlie
on 2021-06-24 15:23:50 |