def hanoi(n,a,b,c):
if n>0:
hanoi(n-1,a,c,b) //n-1个盘子从a经过c移动到b
print("moving from %s to %s" % (a,c)) //最大的盘子从a移动到c
hanoi(n-1,b,a,c) //n-1个盘子从b经过a移动到c
hanoi(3,'A','B','C')
汉诺塔移动次数的递推式:h(x)=2h(x)+1
h(64)=18446744073709551615
假设婆罗门每秒钟搬一个盘子,则总共需要5800亿年