OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
Edvard Davtyan and Lewin Gan, 632C - The Smallest String Concatenation, Tutorial, Educational Codeforces Round 9.
MATHEMATICA
a[n_]:=Min[FromDigits/@Flatten/@IntegerDigits/@Permutations[Divisors[n]]]; Array[a, 38] (* James C. McMahon, Nov 13 2025 *)
PROG
(PARI) a(n) = {my(d=apply(x->Str(x), divisors(n)), d2=vecsort(d, (x, y)->cmp(concat(x, y), concat(y, x)))); eval(concat(d2))}
(Python)
from sympy import divisors
from functools import cmp_to_key
def c(x, y): return -1 if x+y < y+x else int(x+y > y+x)
def a(n): return int("".join(sorted(list(map(str, divisors(n))), key=cmp_to_key(c))))
print([a(n) for n in range(1, 39)]) # Michael S. Branicky, Nov 12 2025
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Jason Yuen, Nov 12 2025
STATUS
approved
