# Maple code from Robert Israel, Feb 9 2017
# ff := proc(n) local P,E,F,np,e,eq,i,bsf,z,agenda,t,eqt,sindets,S,s,V,v,sv,x,j;
# F := sort(ifactors(n)[2],(s,t)->s[1]t[1],F); E := map(t->t[2],F);
# if np=1 then return n/P[1] end if;
# if E=[1,1] then return n*P[1] end if;
# eq := mul(e[i]+E[i]+1,i=1..nops(E)) - 2*mul(e[i]+1,i=1..nops(E));
# bsf := infinity;
# if 20<=rhs(t),s))];
# for v in V do
# sv := subs(z=v,s);
# x := subs(sv,[e[1],e[2],op(t)]);
# x := mul(P[i]^x[i],i=1..np);
# bsf := min(x,bsf)
# end do
# end do
# else
# S := remove(hastype,S,negative);
# for s in S do
# x := subs(s,[e[1],e[2],op(t)]);
# x := mul(P[i]^x[i],i=1..np);
# bsf := min(x,bsf)
# end do
# end if;
# if mul(P[i+2]^t[i],i=1..np - 2)