Move the Stack 2

Logic Level 3

The disks below can be moved from peg to peg according to the following rules:

  1. Only one disk can be moved at a time.

  2. Each move consists of taking the upper disk from a stack and placing it on top of another stack or on an empty peg.

  3. No larger disk may be placed on top of a smaller disk.

What is the smallest number of moves needed to create a stack of exactly 30 30 disks in ascending order by size on the middle or right peg?

Inspiration: Move the Stack


The answer is 1610612733.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

David Vreken
Oct 5, 2019

Suppose we started with 4 4 disks (in ascending order) with the top two disks the same on one peg and wanted to move the top 2 2 disks over to another peg. This would take a minimum of 2 2 moves.

Now suppose we wanted to move the top 3 3 over to another peg instead. We would need to move the top 2 2 disks over to one peg ( 2 2 moves), then move the third disk over to a different peg ( 1 1 move), and then move the top 2 2 disks again on top of the third disk ( 2 2 moves) for a total of 2 + 1 + 2 = 5 2 + 1 + 2 = 5 moves.

Now suppose we wanted to move the top 4 4 over to another peg instead. We would need to move the top 3 3 disks over to one peg ( 5 5 moves), then move the fourth disk over to a different peg ( 1 1 move), and then move the top 3 3 disks again on top of the fourth disk ( 5 5 moves) for a total of 5 + 1 + 5 = 11 5 + 1 + 5 = 11 moves.

This is a recursive pattern, so that if a n a_n is the minimum number of moves to move n n disks (where the top two are the same and the rest are different in ascending order), then a 2 = 2 a_2 = 2 and a n = 2 a n 1 + 1 a_n = 2a_{n - 1} + 1 for n > 2 n > 2 . The first few terms are 2 2 , 5 5 , 11 11 , 23 23 , 47 47 , 95 95 , 191 191 and so on, and it can be shown by induction to satisfy a n = 3 2 n 2 1 a_n = 3 \cdot 2^{n - 2} - 1 for n 1 n \geq 1 .

In this problem, we are almost moving n = 31 n = 31 disks over, except the first move is already given, and we don't need the last move since we only need to end with a stack of 30 30 , so the minimum number of moves needed is a 31 1 1 = ( 3 2 31 2 1 ) 1 1 = 1610612733 a_{31} - 1 - 1 = (3 \cdot 2^{31 - 2} - 1) - 1 - 1 = \boxed{1610612733} .

It's a bit annoying that some people may find it correctly while repeatedly mistakenly input the value of 3.2^29.

Haha, but nice problem :)

Afkar Aulia - 1 year, 7 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...