OFFSET
1,10
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(11) = 3 because of the divisors of 11, there is one 1 in 1 and two in 11.
a(60) = 4 because of the divisors of 60, there is one 1 in 1, one in 10, one in 12, one in 15 and none in the other divisors.
MAPLE
f:= proc(n) local d; add(numboccur(1, convert(d, base, 10)), d=numtheory:-divisors(n)) end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_]:=Count[IntegerDigits[Divisors[n]]//Flatten, 1]; Array[a, 100] (* Stefano Spezia, Aug 28 2025 *)
PROG
(Python)
from sympy import divisors
def a(n): return sum(str(d).count("1") for d in divisors(n, generator=True))
print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Aug 27 2025
(PARI) a(n) = sumdiv(n, d, #select(x->(x==1), digits(d))); \\ Michel Marcus, Aug 28 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Aug 27 2025
STATUS
approved
