結果 : algorithm for recursive function