login
Number of times 3 appears in decimal expansion of n.
9

%I #19 Dec 10 2019 20:02:56

%S 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,1,1,1,2,

%T 1,1,1,1,1,1,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,

%U 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

%N Number of times 3 appears in decimal expansion of n.

%H Robert Israel, <a href="/A316864/b316864.txt">Table of n, a(n) for n = 0..10000</a>

%F From _Robert Israel_, Dec 10 2019: (Start)

%F a(10*n+3) = a(n)+1, a(10*n+i)=a(i) for i = 0,1,2,4..9.

%F G.f. g(z) satisfies g(z) = z^3/(1-z^10) + ((1-z^10)/(1-z))*g(z^10). (End)

%e a(0) = 0 since the decimal representation of 0 does not contain the digit 3.

%e a(3) = 1 since 3 appears once in the decimal expansion of 3.

%p f:= proc(n) option remember;

%p procname(floor(n/10)) + `if`(n mod 10 = 3, 1, 0)

%p end proc:

%p for i from 0 to 9 do f(i):= `if`(i=3,1,0) od:

%p map(f, [$0..100]); # _Robert Israel_, Dec 10 2019

%t Array[ DigitCount[#, 10, 3] &, 105, 0]

%o (PARI) a(n) = #select(x->x==3, digits(n)); \\ _Michel Marcus_, Jul 20 2018

%Y Cf. A043501, A043502, A043503, A043504.

%Y Cf. A055641, A268643, A316864, A316865, A316866, A316867, A316868, A316869, A102683.

%K base,easy,nonn

%O 0,34

%A _Robert G. Wilson v_, Jul 15 2018