// Magma program for OEIS sequence A279070 itos:=IntegerToString; for k in [2..138000] do F:=Factorization(k); s:=""; for j in [1..#F] do if j gt 1 then s*:="*"; end if; s*:=itos(F[j][1]); if F[j][2] gt 1 then s*:="^" * itos(F[j][2]); end if; end for; if #s lt #itos(k) then k, s; end if; end for;