A337925 Digits of n rearranged to be the smallest number with the fewest possible prime factors, counted with multiplicity. Terms retain the same number of digits as n, i.e. leading digits may not be zero.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 13, 41, 15, 61, 17, 18, 19, 20, 21, 22, 23, 42, 25, 26, 27, 82, 29, 30, 13, 23, 33, 43, 53, 63, 37, 83, 39, 40, 41, 42, 43, 44, 45, 46, 47, 84, 49, 50, 15, 25, 53, 45, 55, 65, 57, 58, 59, 60, 61, 26, 63, 46, 65, 66, 67, 86, 69, 70, 17, 27, 37, 47, 57, 67, 77
Offset: 1
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
a[n_] := Module[{p = FromDigits /@ Select[Permutations @ IntegerDigits[n], First[#] > 0 &]}, o = PrimeOmega[p]; Min[p[[Position[o, Min[o]] // Flatten]]]]; Array[a, 100] (* Amiram Eldar, Oct 19 2020 *)
-
PARI
a(n) = {my(d = digits(n), v = select(x->#(digits(x))==#d, vector((#d)!, i, fromdigits(vector(#d, k, d[numtoperm(#d, i-1)[k]])))), b = vecmin(vector(#v, k, bigomega(v[k])))); vecmin(select(x->(bigomega(x)==b), v));} \\ Michel Marcus, Oct 19 2020
Formula
a(a(n)) = a(n). - Rémy Sigrist, Oct 22 2020