A316865 Number of times 4 appears in decimal expansion of n.
0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
Offset: 0
Examples
a(0) = 0 since the decimal representation of 0 does not contain the digit 4. a(4) = 1 since 4 appears once in the decimal expansion of 4.
Crossrefs
Programs
-
Mathematica
Array[ DigitCount[#, 10, 4] &, 105, 0]
-
PARI
a(n) = #select(x->x==4, digits(n)); \\ Michel Marcus, Jul 20 2018