OFFSET
1,2
EXAMPLE
Between 4 and 8, the shortest route is through 12 (2*6); it takes only two steps:
.
1 2 3 4 5 6 7 8
+------+------+------+------+------+------+------+------+
| | | | | | | | |
1 | 1 | 2 | 3 | *4* | 5 | 6 | 7 | .*8* |
| | | | |. | | . | |
+------+------+------+------+---.--+------+-.----+------+
| | | | | . .| | |
2 | 2 | 4 | 6 | 8 | 10 | *12* | 14 | 16 |
| | | | | | | | |
+------+------+------+------+------+------+------+------+
| | | | | | | | |
3 | 3 | 6 | 9 | 12 | 15 | 18 | 21 | 24 |
| | | | | | | | |
+------+------+------+------+------+------+------+------+
| | | | | | | | |
4 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 |
| | | | | | | | |
+------+------+------+------+------+------+------+------+
.
Between 32 and 36, there are several routes that take only three jumps. We choose 32,18,16,36 because the sum of intermediate numbers is the least.
CROSSREFS
KEYWORD
nonn
AUTHOR
Ali Sada, Dec 02 2019
STATUS
approved