好奇心の強い子供は、数値または式を次の形式に分解できるプログラムを使用します。 p1^e1 * p2^e2 * ... * pn^en
。に等しい指数1
は省略されます360 = 2^3 * 3^2 * 5
子供はこの出力を新しい入力としてプログラムに入力しますが、^
符号を理解していないため、対応する素数と指数を連結する1つ以上をスキップすることがあります。例えば(360 =) 2^3 * 3^2 * 5 => 2^3 * 32 * 5 (= 1280)
これらの間違いのために、彼女は別の因数分解を取得する可能性があり、それを再度入力できます(0個以上をスキップします^
)。彼女は、因数分解がそれ以上変化しなくなるまでプロセスを繰り返します(多分それ以上ない^
か、出力を正しくコピーしたかもしれません)。
整数n
(n>1
)が与えられたすべての可能な数を昇順で出力するプログラムまたは関数を作成する必要がありますn
。たとえば、入力16
の最終的な因数分解は次のとおりです。(16 =) 2^4, (24 =) 2^3 * 3, (23*3 =) 3 * 23
入力の詳細:
- 入力は、より大きな単一の整数です
1
- より大きい出力数を生成する入力は与えられません
2^31-1
1000
出力以上の数を生成する入力は与えられません
出力の詳細:
- あなたの言語にとって便利な形式の整数のリスト
例:
入力=>出力
11 => 11
16 => 16 24 69
360 => 140 360 770 1035 1219 1280 2875 3680
605 => 560 605 840 2415
2048 => 211 2048
58564 => 230 456 1311 2508 9975 12768 13794 20748 58564 114114 322102
これはコードゴルフなので、最短のプログラムが勝ちます。