A343750 Let S be the set of all numbers that can be obtained by permuting the digits of n (leading zeros can be omitted). Then a(n) is that element of S with the smallest number of divisors. In case of a tie, choose the smallest.
1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 11, 21, 13, 41, 15, 61, 17, 81, 19, 2, 21, 22, 23, 24, 25, 26, 27, 82, 29, 3, 13, 23, 33, 43, 53, 63, 37, 83, 39, 4, 41, 24, 43, 44, 45, 46, 47, 48, 49, 5, 15, 25, 53, 45, 55, 65, 57, 58, 59, 6, 61, 26, 63, 46, 65
Offset: 1
Examples
n = 125, S = {125, 152, 215, 251, 512, 521}. The elements 251 and 521 have the smallest number of divisors which equals 2. The smallest from elements 251 and 521 is 251, thus a(125) = 251.
Programs
-
Mathematica
a[n_] := Module[{perm = FromDigits /@ Permutations[IntegerDigits[n]], d}, d = DivisorSigma[0, perm]; Min @ perm[[Position[d, Min[d]] // Flatten]]]; Array[a, 65] (* Amiram Eldar, Apr 27 2021 *)
-
PARI
a(n) = my(d=digits(n), nb=#d, v=vector(nb!, k, fromdigits(vector(#d, i, d[numtoperm(nb, k)[i]]))), w=apply(numdiv, v)); vecmin(select(x->(numdiv(x)==vecmin(w)), v)); \\ Michel Marcus, Jan 24 2025
Comments