Experiment shows that the first press of a given button adds the amount on its face to the total. The second press in succession subtracts twice the face amount from the total, so that two presses in succession on net subtract the face amount from the total, as can be seen for example in a sequence of presses of 1 from the cleared position:
1,1,0,2,1,3,2,4,...
In accordance with the instructions, label A is used for the 1 key, B for the 3 key and C for the 7 key:
to get press
1 A
2 BAA
3 B
4 BA
5 CBBA (73+1) but ABA is shorter (1+3+1)
6 CAA (71)
7 C
8 CA
9 CBAA (7+31) but ACA is shorter (1+7+1)
10 CA
11 CBA
12 ABCA (1+3+7+1)
13 CAAC (71+7)
14 CBAB (7+3+1+3)
15 CAC
16 CACA
17 CBC
18 CBCA
19 CACAB
20 CBCB
In many of these order doesn't matter, such as CBA = 11 can permute the CBA into any of its 6 permutations. Only successive presses of the same key must be kept together, and separate presses can't be placed together.

Posted by Charlie
on 20091201 16:27:47 