This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A387394 #17 Aug 30 2025 10:26:03 %S A387394 0,1,0,1,0,1,0,1,0,1,0,2,0,1,0,1,0,1,0,2,1,3,1,3,1,2,1,2,1,1,0,2,0,1, %T A387394 0,2,0,1,0,2,0,3,0,3,0,2,0,3,0,2,0,3,0,2,0,2,0,2,0,3,0,2,1,2,0,3,0,1, %U A387394 1,1,0,4,0,1,1,1,0,2,0,2,1,2,0,5,0,1,1,3,0,1,0,3,0,1,0,4,0,1,0 %N A387394 Total number of 2's in the decimal digits of the divisors of n. %H A387394 Robert Israel, <a href="/A387394/b387394.txt">Table of n, a(n) for n = 1..10000</a> %e A387394 a(22) = 3 because among the divisors of 22, 2 has one 2 and 22 has two, for a total of 3. %p A387394 f:= proc(n) local d; add(numboccur(2, convert(d, base, 10)), d=numtheory:-divisors(n)) end proc: %p A387394 map(f, [$1..200]); %t A387394 a[n_]:=Count[IntegerDigits[Divisors[n]]//Flatten, 2]; Array[a, 99] (* _Stefano Spezia_, Aug 29 2025 *) %o A387394 (PARI) a(n) = sumdiv(n, d, #select(x->(x==2), digits(d))); \\ _Michel Marcus_, Aug 28 2025 %o A387394 (Python) %o A387394 from sympy import divisors %o A387394 def a(n): return sum(str(d).count("2") for d in divisors(n, generator=True)) %o A387394 print([a(n) for n in range(1, 100)]) # _Michael S. Branicky_, Aug 29 2025 %Y A387394 Cf. A385494, A387396, A387463. %K A387394 nonn,base,new %O A387394 1,12 %A A387394 _Robert Israel_, Aug 28 2025