login
Number of divisors of n with the same number of decimal digits as n.
0

%I #12 Dec 22 2020 18:31:33

%S 1,2,2,3,2,4,2,4,3,1,1,1,1,1,1,1,1,1,1,2,1,2,1,2,1,2,1,2,1,3,1,2,2,2,

%T 1,3,1,2,2,3,1,3,1,3,2,2,1,4,1,3,2,3,1,3,2,3,2,2,1,6,1,2,2,3,2,4,1,3,

%U 2,4,1,5,1,2,3,3,2,4,1,5,2,2,1,6,2,2,2,4,1,6,2,3,2

%N Number of divisors of n with the same number of decimal digits as n.

%F a(n) = Sum_{d|n} [floor(log_10(d)) = floor(log_10(n))], where [ ] is the Iverson bracket.

%e a(20) = 2; The only divisors of 20 that have the same number of digits as 20 are 10 and 20, so a(20) = 2.

%t Table[Sum[KroneckerDelta[Floor[Log10[i]], Floor[Log10[n]]] (1 - Ceiling[n/i] + Floor[n/i]), {i, n}], {n, 100}]

%o (PARI) a(n) = sumdiv(n, d, #Str(d) == #Str(n)); \\ _Michel Marcus_, Dec 22 2020

%Y Cf. A000005, A055642.

%K nonn,base

%O 1,2

%A _Wesley Ivan Hurt_, Dec 22 2020