OFFSET
1,30
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
a(33) = 3 because among the divisors of 33, 3 has one 3 and 33 has two, for a total of 3.
MAPLE
f:= proc(n) local t; add(subs(x=1, t)^3, t = expand((1+x+x^2)^n)) end proc:
map(f, [$1..100]);
MATHEMATICA
a[n_]:=Count[Flatten[IntegerDigits/@Divisors[n]], 3]; Array[a, 99] (* James C. McMahon, Aug 30 2025 *)
PROG
(Python)
from sympy import divisors
def a(n): return sum(str(d).count("3") for d in divisors(n, generator=True))
print([a(n) for n in range(1, 100)]) # Michael S. Branicky, Aug 29 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Robert Israel, Aug 29 2025
STATUS
approved
