Factorize it! ...badly A curious kid uses a program which can factorize a number or an expression into the following form: p1^e1 * p2^e2 * ... * pn^en. Exponents equal to 1 are omitted e.g. 360 = 2^3 * 3^2 * 5

The kid types this output into the program as new input but she doesn't understand the ^ sign so sometimes she skips one or more of those concatenating the corresponding prime-base and exponent. E.g. (360 =) 2^3 * 3^2 * 5 =&gt; 2^3 * 32 * 5 (= 1280)

Because of these mistakes she might get a different factorization which she can input again (with skipping 0 or more ^'s). She repeats the process until the factorization doesn't change anymore (maybe there are no more ^'s or she copied the output correctly).

You should write a program or function which given an integer n (n&gt;1) outputs all the possible numbers in increasing order whose factorization could be the one the kid ended up with (including n). E.g. for input 16 the possible final factorizations are (16 =) 2^4, (24 =) 2^3 * 3, (23*3 =) 3 * 23

Input details:


input is a single integer bigger than 1
no input will be given which generates output number greater than 2^31-1
no input will be given which generates more than 1000 output numbers


Output details:


a list of integers in a convenient form for your language


Examples:

Input => Output

11    =&gt; 11
16    =&gt; 16 24 69
360   =&gt; 140 360 770 1035 1219 1280 2875 3680
605   =&gt; 560 605 840 2415
2048  =&gt; 211 2048
58564 =&gt; 230 456 1311 2508 9975 12768 13794 20748 58564 114114 322102


This is code-golf so shortest program wins.
CJam - 66

ria{_{:XmF{1=1&gt;},La\{a1$\f++}/La-{XI{~#}%:*/I{si}%:**}fI}%|}1e3*$p


Try it at http://cjam.aditsu.net/

Explanation:

ria                       read token, convert to integer and wrap in array
{…}1e3*                   repeat 1000 times
    _                     duplicate array
    {…}%                  transform each array item (number) using the block
        :X                store the number in X
        mF                factorize with exponents
        {1=1&gt;},           keep only the factors with exponent &gt; 1
        La\{a1$\f++}/     get all the subsets (*)
        La-               remove the empty subset
        {…}fI             for I = each subset of prime factors with exponent &gt; 1
            XI{~#}%:*/    divide X by all the factors in I
            I{si}%:**     multiply with the primes from I
                          concatenated with their exponents
    |                     add the new numbers to the array, removing duplicates
$                         sort
p                         print the final array


(*) Thanks Martin