OFFSET
1,10
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
1 <= n/a(n) <= 9.
EXAMPLE
For n = 42: the divisors of 42 are 1, 2, 3, 6, 7, 14, 21, 42; the least divisor with 2 digits is 14, so a(42) = 14.
MAPLE
f:= proc(n) local d, t;
t:= ilog10(n);
min(select(d -> ilog10(d)=t, numtheory:-divisors(n)))
end proc:
map(f, [$1..100]); # Robert Israel, Nov 06 2024
MATHEMATICA
s={}; Do[m=0; d=Divisors[n]; Until[Length[IntegerDigits[d[[m]]]]==Length[IntegerDigits[n]], m++]; AppendTo[s, d[[m]]], {n, 67}]; s (* James C. McMahon, Nov 06 2024 *)
PROG
(PARI) a(n, base = 10) = { my (w = #digits(n, base)); forstep (x = base-1, 1, -1, if (n%x==0 && #digits(n/x)==w, return (n/x); ); ); }
(Python)
def A377712(n): return n//next(d for d in range(n//10**(len(str(n))-1), 0, -1) if not n%d) # Chai Wah Wu, Nov 06 2024
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Nov 04 2024
STATUS
approved