Mathematica, (削除) 175 (削除ここまで) (削除) 177 (削除ここまで) 169 bytes
Join@@@Table[f@x,{s,{1,-1}},{x,r@#},x[[2]]s]&@*(If[#==1,1,{p,e}=(f=First)@MaximalBy[(r=FactorInteger)@#,f];q=1~Max~NextPrime[p,-1];(p/q)^e#0[#(1##&@@Range[q+1,p])^-e]]&)
How it works
This is the composition of two functions. The first, which ungolfs to
If[#==1,
1,
{p,e}=(f=First)@MaximalBy[(r=FactorInteger)@#,f];
q=1~Max~NextPrime[p,-1];
(p/q)^e #0[#(1##&@@Range[q+1,p])^-e]
]&
is a recursive function for actually computing the desired numbers. Given input x, we find the largest prime factor p appearing in x (to the power e), let q be the prime before p, and recurse on x*(p!/q!)^-e. (So, for example, given x=10/9 we'd pull out a factor of 5!/3! and recurse on 1/18.)
This function computes the result, but (to cancel like factors) it writes the result as a rational number. For example, 10/9 gets mapped to 2*5/3*3*3 = 10/27, which we want to convert to the list {{2,5},{3,3,3}}. That's what the second part,
Join@@@Table[f@x,{s,{1,-1}},{x,r@#},x[[2]]s]&
does: for s=1 (positive powers) and s=-1 (negative powers), and for each term {prime,exponent} in the factorization r@#, we repeat the prime number prime exponent*s many times.
Noncompeting version with 129 bytes
If[∇1=1;#==1,1,{p,e}=(f=First)@MaximalBy[FactorInteger@#,f];q=1~Max~NextPrime[p,-1];(∇p/∇q)^e#0[#(1##&@@Range[q+1,p])^-e]]&
Same as above, but instead of giving output as a list, gives output as an expression, using the ∇ operator (because it has no built-in meaning) as a stand-in for factorials. Thus, an input of 10/9 gives an output of
(∇2 ∇5)/(∇3)^3
This is shorter because we skip the second part of the function.
+2 bytes: the assignment f=First has to be done in the right place to keep Mathematica from getting upset.
-8 bytes: fixed a bug :)
- 5.3k
- 14
- 27