如果n=1,直接輸出1
否則
對n做9~2的因數分解(從9開始因為9<33、8<222)
分解完後如果n不等於1,代表n無法變成以2~9的數字組成的數字
否則把剛剛分解的順數顛倒輸出就好了
範例:
216
216 % 9 = 0, list = "9", n = 24
24 % 9 != 0, list = "9", n = 24
24 % 8 = 0, list = "9, 8", n = 3
3 % 8 != 0, list = "9, 8", n = 3
3 % 7 != 0, list = "9, 8", n = 3
3 % 6 != 0, list = "9, 8", n = 3
3 % 5 != 0, list = "9, 8", n = 3
3 % 4 != 0, list = "9, 8", n = 3
3 % 3 = 0, list = "9, 8, 3", n = 1
1 % 3 != 0, list = "9, 8, 3", n = 1
1 % 2 = 0, list = "9, 8, 3", n = 1
完畢,n = 1,代表有辦法表示,其中最小符合的就是list顛倒後的389