login
A390052
a(1) = 1. For n > 1, a(n) is the smallest number obtainable by rearranging the digits of n whose value has the largest prime factor among all such rearrangements.
3
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 21, 31, 41, 51, 61, 71, 18, 19, 20, 21, 22, 23, 42, 52, 62, 27, 82, 29, 30, 31, 23, 33, 43, 53, 63, 73, 83, 93, 40, 41, 42, 43, 44, 45, 46, 47, 84, 94, 5, 51, 52, 53, 45, 55, 65, 57, 58, 59, 60, 61, 62, 63, 46, 65, 66, 67, 86, 69
OFFSET
1,2
COMMENTS
Any leading zeros of a rearrangement are discarded.
LINKS
EXAMPLE
a(153) = 531 since the digits of 153 can be rearranged to 135,315,351,513 and 531; and 531 has the largest prime factor of the set (59).
MATHEMATICA
A390052[n_] := Last[SortBy[Map[FromDigits, Permutations[IntegerDigits[n]]], FactorInteger[#][[-1, 1]] &, Less]];
Array[A390052, 100] (* Paolo Xausa, Oct 31 2025 *)
PROG
(Python)
from sympy import factorint
from itertools import permutations
def a(n):
if n == 1: return 1
m, argm = 0, None
for p in permutations(sorted(str(n))):
t = int("".join(p))
f = 0 if t == 1 else max(factorint(t))
if f > m: m, argm = f, t
return argm
print([a(n) for n in range(1, 70)])
(PARI) gpf(n) = if (n==1, 1, vecmax(factor(n)[, 1]));
a(n) = my(d = digits(n), vi = vecsort(vector((#d)!, i, my(p = numtoperm(#d, i-1)); fromdigits(vector(#d, k, d[p[k]])))), vg = apply(gpf, vi), vmax = vecmax(vg), vs = select(x->(x==vmax), vg, 1)); vi[vs[1]]; \\ Michel Marcus, Oct 24 2025
CROSSREFS
Cf. A006530, A390053, A387938 (fixed points).
Sequence in context: A378808 A064222 A261294 * A321474 A333659 A336956
KEYWORD
nonn,base,look
AUTHOR
Michael S. Branicky and Ali Sada, Oct 22 2025
STATUS
approved