A357299 a(n) is the number of divisors of n whose first digit equals the first digit of n.
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3
Offset: 1
Examples
The divisors of 26 that start in 2 are 2 and 26, so a(26) = 2.
Links
- Michel Marcus, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
f[n_] := IntegerDigits[n][[1]]; a[n_] := DivisorSum[n, 1 &, f[#] == f[n] &]; Array[a, 100] (* Amiram Eldar, Sep 23 2022 *)
-
PARI
a(n) = my(fd=digits(n)[1]); sumdiv(n, d, digits(d)[1] == fd); \\ Michel Marcus, Sep 23 2022
-
Python
from sympy import divisors def a(n): f = str(n)[0]; return sum(1 for d in divisors(n) if str(d)[0]==f) print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Sep 23 2022
Comments