Skip to content

Tower of Hanoi

puzzles

Level 2 of 3

Also called Towers of Hanoi, Tower of Brahma and Lucas' tower.

how it works

The idea with 3 discs, as the watch page runs it.

Three pegs stand in a row, A, B and C. A tower of discs sits on A, each disc smaller than the one under it. Move the whole tower to C. You move one disc at a time, always a top disc, and never put a disc on a smaller one. The method thinks about the biggest disc. To move it, every disc above it must first go to the spare peg, B. Then the biggest moves to C, and the rest move back on top of it. Each smaller tower moves the same way, with the pegs' jobs swapped: to take 2 discs to B, C is the spare. A single disc just moves. This page counts moves, one for each disc moved.

movediscfromtothe pegs after
11ACA: 3, 2; C: 1
22ABA: 3; B: 2; C: 1
31CBA: 3; B: 2, 1
43ACB: 2, 1; C: 3
51BAA: 1; B: 2; C: 3
62BCA: 1; C: 3, 2
71ACC: 3, 2, 1
3 discs, as the run moves them. Each peg lists its discs from the bottom up. Moves 1 to 3 clear discs 1 and 2 onto B, move 4 takes disc 3 to C, and moves 5 to 7 bring the two back on top.
Three discs: 8 moments of its 11 steps, the steps between them left for the watch page
  1. step 1 of 11

    321ABC

    Move all 3 discs from peg A to peg C, one disc at a time, never putting a disc on a smaller one. Peg B is there to help.

    what it remembers to know where it is
    discs in this part
    3
    from peg
    A
    to peg
    C

    watch from here

  2. step 2 of 11

    321ABC

    To move 3 discs from A to C, first move the 2 above the biggest out of the way, onto B. That is a smaller tower, moved the same way.

    what it remembers to know where it is
    discs in this part
    3
    from peg
    A
    to peg
    C

    watch from here

  3. step 3 of 11

    321ABC

    Move disc 1 from A to C.

    what it remembers to know where it is
    discs in this part
    1
    from peg
    A
    to peg
    C

    watch from here

  4. step 4 of 11

    321ABC

    Move disc 2 from A to B.

    what it remembers to know where it is
    discs in this part
    2
    from peg
    A
    to peg
    B

    watch from here

  5. step 6 of 11

    213ABC

    Move disc 3 from A to C: it is where it belongs, and it will not move again.

    what it remembers to know where it is
    discs in this part
    3
    from peg
    A
    to peg
    C

    watch from here

  6. step 7 of 11

    213ABC

    The biggest of those 3 is on C. Now move the 2 on B onto it, using A to help, the same way again.

    what it remembers to know where it is
    discs in this part
    3
    from peg
    A
    to peg
    C

    watch from here

  7. step 10 of 11

    321ABC

    Move disc 1 from A to C: it is where it belongs, and it will not move again.

    what it remembers to know where it is
    discs in this part
    1
    from peg
    A
    to peg
    C

    watch from here

  8. step 11 of 11

    321ABC

    All 3 discs are on C after 7 moves. That is twice the moves for one disc fewer, and one more. No way takes fewer.

    what it remembers to know where it is
    discs in this part
    not yet
    from peg
    not yet
    to peg
    not yet

    Where it says not yet, nothing is held there at that moment.

    watch from here

the steps, in plain words
  1. to move n discs from one peg to another, with the third peg to help:Python lines 9 and 17
  2. if n is 1, move that one disc, and stopPython lines 10, 11 and 12
  3. first move the n - 1 discs above the biggest onto the third pegPython line 13
  4. move the biggest disc to where it is goingPython line 14
  5. then move the n - 1 discs from the third peg onto itPython line 15
the same in Python

The steps in plain words are what to learn. Python is a programming language, and the code below does the same steps, for those who code. Python numbers the places in a list from 0, not 1: the first number is numbers[0], the second numbers[1], and so on.

def tower_of_hanoi(n):
    """Move n discs from peg A to peg C, one at a time, never a disc on a smaller one.

    n is a whole number from 1. Returns every move in order, each [disc, from, to],
    with disc 1 the smallest.
    """
    moves = []

    def move(k, source, target, spare):  # move discs 1 to k from source to target
        if k == 1:  # one disc simply moves
            moves.append([1, source, target])
            return
        move(k - 1, source, spare, target)  # the k - 1 above the biggest, onto spare
        moves.append([k, source, target])  # the biggest, disc k, to where it is going
        move(k - 1, spare, target, source)  # the k - 1 from spare back onto it

    move(n, "A", "C", "B")  # all n discs from A to C, with B to help
    return moves

how it scales

The plot counts the moves the method makes for nn discs, measured from 1 to 13.

Each mark up is ten times the one before, and each mark across adds the same number of discs. Each disc about doubles the moves, so each step across lifts the point by about the same height. From 3 discs to 13, the moves go from 7 to 8,191, about a thousand times: three marks up. So the points climb in a nearly straight line. Question 1 in section 4 works out why.

discs moved, ten times more at each mark up

a seconda minutean hour10210410610810101012010203040a seconda minutean hour1011021031041051061071081091010101110121013010203040a seconda minutean hour1011021031041051061071081091010101110121013010203040

nn, how many discs there are, the same step more at each mark to the right

  • moving nn discs, the one run there is for that nnsolid where measured by running it; dashed where its formula carries it on to 40
how long these moves take, at a billion a second
nndiscs movedtime
138,191about 8.2 microseconds
27134,217,727about 134 milliseconds
401,099,511,627,775about 18 minutes

The discs moved are the same on any computer. The times are not: a real computer may be faster or slower than a billion a second.

make these counts yourself

Copy this script and run it with Python 3.12 or later. It counts the same steps as the plot. Where a count depends on a random shuffle, yours will differ a little.

"""Count Tower of Hanoi's moves yourself, as the plot on this page does.

Run it with Python 3.12 or later. For each number of discs from 1 to 13 it
prints the moves the method makes, and 2 to the power n, less 1, beside them.
The counts are the same on any computer; only the time differs.
"""


def tower_of_hanoi(n):
    """Move n discs from peg A to peg C, one at a time, never a disc on a smaller one.

    n is a whole number from 1. Returns every move in order, each [disc, from, to],
    with disc 1 the smallest.
    """
    moves = []

    def move(k, source, target, spare):  # move discs 1 to k from source to target
        if k == 1:  # one disc simply moves
            moves.append([1, source, target])
            return
        move(k - 1, source, spare, target)  # the k - 1 above the biggest, onto spare
        moves.append([k, source, target])  # the biggest, disc k, to where it is going
        move(k - 1, spare, target, source)  # the k - 1 from spare back onto it

    move(n, "A", "C", "B")  # all n discs from A to C, with B to help
    return moves


def count(n):
    """The same method on n discs, counting its moves and keeping none."""
    if n == 1:
        return 1
    return count(n - 1) + 1 + count(n - 1)


if __name__ == "__main__":
    print(f"{'discs':>5} {'moves':>9} {'2^n - 1':>9}")
    for n in range(1, 14):
        print(f"{n:>5} {count(n):>9} {2 ** n - 1:>9}")

best, worst and average

Best, worst and average usually name different inputs of one size. Here the input is nn alone, so each nn is one input and one run, the same every time. So the table has one column, under the name worst, and no average is worked out.

A case is one kind of input. A bound says how fast its cost grows as nn grows.

The counts are in the grid. A count is often the sum of pieces that grow at different speeds, and on long inputs the fastest-growing piece swamps the rest. For example, a count of half of n times n, less half of n: at 2,000 items, 2,000,000 less 1,000. So how a cost grows is what tells one method from another, and the bounds keep just that.

what each case costs, and how fast that cost grows; section 4 works out every formula in it
worstmoving nn discs, the one run there is for that nn
discs moved2n−12^n - 1
how the discs moved grow in each case
tight, Θ\ThetaΘ(2n)\Theta(2^n)
ceiling, OOO(2n)O(2^n)
floor, Ω\OmegaΩ(2n)\Omega(2^n)

extra memory: at most nn calls at once, one for each tower size still being moved, and the list of 2n−12^n - 1 moves the code hands back.

Extra memory is the room it needs on top of the input itself, while it runs.

discsmovesfrom the row above
11one disc simply moves
232 times 1, plus 1
372 times 3, plus 1
4152 times 7, plus 1
5312 times 15, plus 1
6632 times 31, plus 1
Counted by the run, from 1 disc to 6, the most the watch page takes. Each count is twice the one above, plus 1, and one less than a power of 2.

where the formula comes from

Three questions, each worked line by line. Question 1 is the count the plot draws.

Question 1: how many moves, MM, does the method make for nn discs, from 1 up?
  1. the move: the rule

    the line:
    moves for n discs:those for n−1, then 1,then those for n−1\begin{gathered} \text{moves for } n \text{ discs:} \\ \text{those for } n - 1, \text{ then 1,} \\ \text{then those for } n - 1 \end{gathered}

    why it is allowed: To move nn discs, the method moves the n−1n - 1 above the biggest out of the way, moves the biggest once, and moves the n−1n - 1 back on top. For 3 discs, 3 moves, then 1, then 3, which is 7.

  2. the move: each disc in turn

    the line:
    disc n moves once, andeach smaller disc twice asoften as the next bigger\begin{gathered} \text{disc } n \text{ moves once, and} \\ \text{each smaller disc twice as} \\ \text{often as the next bigger} \end{gathered}
    3 discsfirst halfmiddlesecond half
    moves1 to 345 to 7
    which disc1, 2, 131, 2, 1
    From the run. Disc 3 moves once, in the middle. Each half moves discs 1 and 2 as a tower, so disc 2 moves twice and disc 1 four times.

    why it is allowed: By line 1, disc nn moves once, in the middle, and the tower above it moves twice. In each of those, disc n−1n - 1 is the biggest and moves once, so twice in all. Each splits the same way, so the third biggest disc moves 4 times, and on.

  3. the move: add them up

    the line:
    M=1+2+4+⋯+2n−1M = 1 + 2 + 4 + \dots + 2^{n - 1}

    why it is allowed: By line 2, disc nn moves once, disc n−1n - 1 twice, and on, doubling each time, down to disc 1. Disc 1 is n−1n - 1 doublings from disc nn, so it moves 2n−12^{n - 1} times. For 3, 1 + 2 + 4.

  4. the move: add the doublings

    the line:
    M=2n−1M = 2^n - 1
    where does this come from?
    question 1 of the page doubling and halving sumsAdd 1+2+4+⋯+2n1 + 2 + 4 + \dots + 2^n. What is the total?
    1. the move: name the sum

      the line:
      S=1+2+4+⋯+2nS = 1 + 2 + 4 + \dots + 2^n

      why it is allowed: Let SS be the doubling sum up to 2n2^n. For nn as 3, it is 1 + 2 + 4 + 8.

    2. the move: double both sides

      the line:
      2S=2+4+8+⋯+2n+12S = 2 + 4 + 8 + \dots + 2^{n + 1}

      why it is allowed: Each term doubled is the next one along, and 2n2^n becomes 2n+12^{n + 1}. Doubling both sides keeps them equal. The plan: the two sums share all but their ends.

    3. the move: take line 1 away

      the line:
      2S−S=(2+4+⋯+2n+1)−(1+2+⋯+2n)\begin{aligned} 2S - S = {} & (2 + 4 + \dots + 2^{n + 1}) \\ & - (1 + 2 + \dots + 2^n) \end{aligned}

      why it is allowed: Take SS from both sides of line 2. On the right, write SS out as line 1 does.

    4. the move: tidy the left side

      the line:
      S=(2+4+⋯+2n+1)−(1+2+⋯+2n)\begin{aligned} S = {} & (2 + 4 + \dots + 2^{n + 1}) \\ & - (1 + 2 + \dots + 2^n) \end{aligned}

      why it is allowed: Two lots of SS less one lot is one lot.

    5. the move: cancel what both brackets share

      the line:
      S=2n+1−1S = 2^{n + 1} - 1
      when n is 3124816
      first bracket24816
      second bracket1248
      left overtake away 116
      Line 4 when nn is 3. The 2, 4 and 8 cancel, leaving 16 less 1, which is 15.

      why it is allowed: Every term from 2 to 2n2^n is in both brackets and cancels, leaving 2n+12^{n + 1} less 1.

    6. the move: the terms before the last

      the line:
      1+2+⋯+2n−1=2(n−1)+1−1\begin{gathered} 1 + 2 + \dots + 2^{n - 1} \\ = 2^{(n - 1) + 1} - 1 \end{gathered}

      why it is allowed: The sum of line 5 stopping one term sooner: line 5 with n−1n - 1 for nn. For 3, it is 1 + 2 + 4. At nn as 0 no terms are left, adding to 0, and 2 to the power 0, less 1, is 0 too.

    7. the move: tidy the power

      the line:
      2(n−1)+1−1=2n−12^{(n - 1) + 1} - 1 = 2^n - 1

      why it is allowed: One more than n−1n - 1 is nn. For 3, 1 + 2 + 4 is 7, one less than 8.

    8. the move: read it

      the line:
      one less thanthe next term,under twice the last\begin{gathered} \text{one less than} \\ \text{the next term,} \\ \text{under twice the last} \end{gathered}

      why it is allowed: By lines 6 and 7, the terms before the last add to one less than it: the last outweighs them all. By line 5 the sum is under 2n+12^{n + 1}, twice the last.

    the whole page: doubling and halving sums

    why it is allowed: The box under this line shows a doubling sum from 1 is one less than its next term. Its lines 6 and 7 take this sum, ending at 2n−12^{n - 1}, to 2n−12^n - 1. For 3, 1 + 2 + 4 is 7, one less than 8.

  5. the move: a ceiling

    the line:
    M≤2nM \le 2^n

    why it is allowed: By line 4, MM is 2n−12^n - 1, 1 less than 2n2^n. For 3, 7 is at most 8.

  6. the move: read the bound

    the line:
    M∈O(2n)M \in O(2^n)

    why it is allowed: By line 5, with the fixed multiple 1. O(2n)O(2^n) means at most a fixed multiple of 2n2^n, from some nn on.

  7. the move: split the power

    the line:
    M=2n−1+(2n−1−1)M = 2^{n - 1} + (2^{n - 1} - 1)

    why it is allowed: By line 4, MM is 2n−12^n - 1, and 2n2^n is 2n−12^{n - 1} twice over, so take the 1 from the second. For 3, 7 is 4 plus 3.

  8. the move: a floor

    the line:
    M≥2n−1M \ge 2^{n - 1}
    nn2n−12^{n - 1}MM2n2^n
    1112
    2234
    3478
    105121,0231,024
    MM sits between half of 2n2^n and 2n2^n. Row 10 is section 7's count.

    why it is allowed: The bracket in line 7 is at least 0, as 2n−12^{n - 1} is at least 1. For 3, 7 is at least 4.

  9. the move: read the bound

    the line:
    M∈Ω(2n)M \in \Omega(2^n)

    why it is allowed: By line 8. 2n−12^{n - 1} is half of 2n2^n, so the fixed multiple is a half. Ω\Omega means at least a fixed multiple, above 0, from some nn on.

  10. the move: both together

    the line:
    M∈Θ(2n)M \in \Theta(2^n)

    why it is allowed: Lines 6 and 9 bound MM by the same growth, 2n2^n, from above and below. By line 1, one more disc doubles the moves and adds 1.

try it with a small nn: at n=3n = 3, line 3 gives M=7M = 7, which you can work out by hand

Question 2: check 2n−12^n - 1 another way, from question 1's line 1 and one disc's single move. Let PP be the moves for nn discs, worked out from those for n−1n - 1, for nn of 2 or more.
  1. the move: the start

    the line:
    1 disc takes 1 move,and 21−1 is 1\begin{gathered} 1 \text{ disc takes 1 move,} \\ \text{and } 2^1 - 1 \text{ is } 1 \end{gathered}

    why it is allowed: One disc simply moves, once. So 2n−12^n - 1 is right for 1 disc.

  2. the move: the step

    the line:
    suppose n−1 discs take2n−1−1 moves\begin{gathered} \text{suppose } n - 1 \text{ discs take} \\ 2^{n - 1} - 1 \text{ moves} \end{gathered}

    why it is allowed: Take any nn from 2 up, and suppose the count is right for one disc fewer. For 3 discs, suppose 2 discs take 3 moves, which is 4 less 1.

  3. the move: use the rule

    the line:
    P=2(2n−1−1)+1P = 2(2^{n - 1} - 1) + 1

    why it is allowed: By question 1's line 1, nn discs take twice the moves for n−1n - 1, plus 1. Put in line 2's count. For 3, 2 times 3, plus 1.

  4. the move: multiply out

    the line:
    P=2n−2+1P = 2^n - 2 + 1

    why it is allowed: Twice 2n−12^{n - 1} is 2n2^n, and twice 1 is 2. For 3, 8 less 2, plus 1.

  5. the move: tidy

    the line:
    P=2n−1P = 2^n - 1
    discsfrom the one before2n−12^n - 1
    1the start, 11
    22 times 1, plus 1, is 33
    32 times 3, plus 1, is 77
    42 times 7, plus 1, is 1515
    The start, then the step again and again. Each row's count agrees with 2n−12^n - 1, so the next row's does too.

    why it is allowed: Less 2, plus 1, is less 1. For 3, 7, so the count is right for 3 discs too.

  6. the move: every n

    the line:
    2n−1 is rightfor every n\begin{gathered} 2^n - 1 \text{ is right} \\ \text{for every } n \end{gathered}

    why it is allowed: Line 1 starts it at 1 disc. Lines 2 to 5 carry it from any number of discs to one more. So it holds at 2, then 3, and on, for every nn.

try it with a small nn: at n=3n = 3, line 3 gives P=7P = 7, which you can work out by hand

Question 3: could any way of moving the discs take fewer moves? Let FF be the fewest moves any way can take for nn discs.
  1. the move: the biggest must move

    the line:
    the biggest disc movesat least once\begin{gathered} \text{the biggest disc moves} \\ \text{at least once} \end{gathered}

    why it is allowed: It starts on A and must end on C, and only a move takes it there.

  2. the move: before its first move

    the line:
    when it first moves, then−1 others are allon the spare peg\begin{gathered} \text{when it first moves, the} \\ n - 1 \text{ others are all} \\ \text{on the spare peg} \end{gathered}
    pegdiscs from the bottom up
    A3
    B2, 1
    Cnone
    3 discs, just before disc 3 first moves, at move 4. Discs 1 and 2 wait on B, the only peg left.

    why it is allowed: To move, it must be on top, so no disc is on it. No smaller disc may be where it lands, either. So every smaller disc is on the spare peg, the one it neither leaves nor lands on.

  3. the move: so a smaller tower moved

    the line:
    getting them there takesat least the fewest forn−1 discs\begin{gathered} \text{getting them there takes} \\ \text{at least the fewest for} \\ n - 1 \text{ discs} \end{gathered}

    why it is allowed: Moving n−1n - 1 discs from A to one other peg is the same puzzle, one disc smaller, with the pegs renamed. The biggest disc never gets in the way, as any disc may sit on it.

  4. the move: after its last move

    the line:
    after its last move, theymove onto it: at leastas many again\begin{gathered} \text{after its last move, they} \\ \text{move onto it: at least} \\ \text{as many again} \end{gathered}

    why it is allowed: When it last moves, onto C, the others are all on the spare peg again, for line 2's reason. Moving them from there onto C is the smaller puzzle again.

  5. the move: add them

    the line:
    the fewest for n is at least2×the fewest for n−1,plus 1\begin{gathered} \text{the fewest for } n \text{ is at least} \\ 2 \times \text{the fewest for } n - 1, \\ \text{plus } 1 \end{gathered}

    why it is allowed: Lines 3 and 4 count the moves before the biggest disc first moves and after it last moves. Line 1 adds at least 1 between them. No move is counted twice.

  6. the move: the same climb

    the line:
    so the fewest is atleast 2n−1\begin{gathered} \text{so the fewest is at} \\ \text{least } 2^n - 1 \end{gathered}
    discsthe fewest is at leastwhy
    11line 1
    232 times 1, plus 1
    372 times 3, plus 1
    4152 times 7, plus 1
    Each row is at least the row above doubled, plus 1: the same climb as question 2's.

    why it is allowed: Start: 1 disc needs at least 1 move, by line 1. Step: if n−1n - 1 discs need at least 2n−1−12^{n - 1} - 1, line 5 gives at least 2(2n−1−1)+12(2^{n - 1} - 1) + 1. That is 2n−12^n - 1, by question 2's lines 4 and 5. So, as in question 2's line 6, it holds for every nn.

  7. the move: the fewest

    the line:
    F=2n−1F = 2^n - 1

    why it is allowed: By line 6 no way takes fewer, and question 1's method takes exactly 2n−12^n - 1. So the method takes the fewest moves there can be. For 3 discs, 7.

try it with a small nn: at n=3n = 3, line 7 gives F=7F = 7, which you can work out by hand

count it yourself

3 discs, step by step. The steps that only say which part comes next move no disc, so they add nothing.

3, every step written down
stepthe rowwhat happensdiscs moved
1A: 3, 2, 1Move all 3 discs from peg A to peg C, one disc at a time, never putting a disc on a smaller one. Peg B is there to help.A: 3, 2, 10
2A: 3, 2, 1To move 3 discs from A to C, first move the 2 above the biggest out of the way, onto B. That is a smaller tower, moved the same way.A: 3, 2, 10
3A: 3, 2; C: 1Move disc 1 from A to C.A: 3, 2; C: 11
4A: 3; B: 2; C: 1Move disc 2 from A to B.A: 3; B: 2; C: 12
5A: 3; B: 2, 1Move disc 1 from C to B.A: 3; B: 2, 13
6B: 2, 1; C: 3Move disc 3 from A to C: it is where it belongs, and it will not move again.B: 2, 1; C: 34
7B: 2, 1; C: 3The biggest of those 3 is on C. Now move the 2 on B onto it, using A to help, the same way again.B: 2, 1; C: 34
8A: 1; B: 2; C: 3Move disc 1 from B to A.A: 1; B: 2; C: 35
9A: 1; C: 3, 2Move disc 2 from B to C: it is where it belongs, and it will not move again.A: 1; C: 3, 26
10C: 3, 2, 1Move disc 1 from A to C: it is where it belongs, and it will not move again.C: 3, 2, 17
11C: 3, 2, 1All 3 discs are on C after 7 moves. That is twice the moves for one disc fewer, and one more. No way takes fewer.C: 3, 2, 17

In all, 7 discs moved. The formula from section 4, 1+2+4+⋯+2n−11 + 2 + 4 + \dots + 2^{n - 1}, gives M=7M = 7 at n=3n = 3: the same.

where you meet it

Tower of Hanoi is a puzzle from 1883, and its moves hide a pattern found in counting.

  • Edouard Lucas

    The French mathematician Edouard Lucas invented the puzzle. In 1883 he put it out under a made-up name, Claus: shuffle its letters and they spell Lucas.

    source: the MacTutor History of Mathematics, Edouard Lucas (opens in a new tab)

  • the ruler function

    Number the moves 1, 2, 3 and on, and halve each move's number while it stays a whole number. Each move takes disc 1 plus its number of halvings: move 4 halves twice, to 2 and then 1, so it takes disc 3. These numbers are called the ruler function.

    source: the On-Line Encyclopedia of Integer Sequences, A001511 (opens in a new tab)

movehalvingsdisc
101
212
301
423
501
612
701
Section 1's 7 moves with 3 discs. The disc each move takes is 1 more than its halvings. Down the disc column, 1, 2, 1, 3, 1, 2, 1, like a ruler's marks.

what is used instead

To work the moves out with no calls waiting, use the smallest disc's rule. On odd moves, move disc 1 one peg along. It goes A to C to B and round for an odd number of discs, and A to B to C for an even one. For 3 discs, moves 1, 3, 5 and 7 take disc 1 from A to C, C to B, B to A and A to C. Section 1's table shows them. On even moves, make the only move that leaves disc 1 alone. It makes the same 2n−12^n - 1 moves.

how it compares

The method uses itself on a smaller tower, and each call waits while its smaller tower moves, as the first table shows. The smallest disc's rule in section 6 makes the very same moves with nothing waiting. A fourth peg changes the puzzle. J. S. Frame and B. M. Stewart's way, from 1941, moves most of the discs aside using all four pegs, then the few biggest across on the three pegs left, then the rest back on top.

callits partat move 1
for 3 discsA to Cwaiting
for 2 discsA to Bwaiting
for 1 discA to Cmoving disc 1 now
3 discs at move 1, one call started and not done for each tower size, 3, 2 and 1, at most nn at once.
way10 discs20 discs
this method1,023 moves1,048,575 moves
the smallest disc's rule1,023 moves1,048,575 moves
four pegs, Frame and Stewart's way49 moves289 moves
Each row counted by running the way. The first two make the very same moves. With four pegs, the moves grow far more slowly.
discsaside on four pegsbiggest on three pegsmoves
106 discs, 17 moves there and 17 back4 discs, 15 moves17 + 15 + 17 = 49
2014 discs, 113 moves there and 113 back6 discs, 63 moves113 + 63 + 113 = 289
Frame and Stewart's way at its best split, counted by running it. For 20 discs, 15 aside and 5 on three also make 289.