I wonder – what is the most efficient solution – fewest number of moves?

]]>For n>1, let f(k,n,m) be the maximum value of d which can be obtained starting with

[n,m,0 … 0] (with k-2 zeros)

and ending with

[0,d,0 … 0]

Define f(1,n,0)=n (equivalent to [n] goes to [n])

Then (except perhaps for some marginal cases where m=1, which never arise staring with [n,0 … 0]

for k>1 f(k,n,0)=f(k,n-1,2)

(for n>0) f(k,n,m) = f(k,n-1,f(k-1,m,0))

and f(k,0,m) = f(k-1,m,0)

has the total number of coins bounded. ]]>

BUT with [1,?,?, … ?] there can be advantages in using the first type of move more often, and the numbers in the left-hand places may not create the full value.

This creates constraints on how useful conserved quantities might be computed.

]]>[1,1,1,1,1,1] goes to [1,0,0,2^14,0,0]

(nb the 7 is special at the tail – doesn’t quite fit the pattern)

(note 2^14 = 2^(2*7) which brings out the roles of 2 and 7 separately

and 2*2^(2^(2*7)) – two multiplications by 2, two powers

– the powers in between the multiplications in a chiastic structure)

[1,0,0,2^(2*7),0,0] goes to [0,2,0,2^(2*7),0,0]

The 2 in the second place is the source of two operations of the highest kind which appear in the answer.

The zeros at the end give space to repeat the power and multiplication operation in reverse.

This goes to [0,1,2^(2*7),0,0,0]

Which goes to [0,1,0,2^^(2^(2*7)),0,0]

Which goes to [0,0,2^^(2^(2*7)),0,0,0]

Which goes to [0,0,2^^(2^^(2^(2*7)),0,0]

… and eventually the result is 2*2^(2^^(2^^(2^(2*7)))

]]>