login
A377712
a(n) is the least divisor of n with as many decimal digits as n.
1
1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 21, 11, 23, 12, 25, 13, 27, 14, 29, 10, 31, 16, 11, 17, 35, 12, 37, 19, 13, 10, 41, 14, 43, 11, 15, 23, 47, 12, 49, 10, 17, 13, 53, 18, 11, 14, 19, 29, 59, 10, 61, 31, 21, 16, 13, 11, 67
OFFSET
1,10
LINKS
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
Sequence in context: A305947 A100830 A180176 * A350494 A168100 A088475
KEYWORD
nonn,base,easy
AUTHOR
Rémy Sigrist, Nov 04 2024
STATUS
approved