|
|
A196564
|
|
Number of odd digits in decimal representation of n.
|
|
49
|
|
|
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 1, 0, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,12
|
|
LINKS
|
|
|
FORMULA
|
a(n) = Sum_{j=0..m} (floor(n/(2*10^j) + (1/2)) - floor(n/(2*10^j)), where m=floor(log_10(n)).
a(10n+k) = a(n) + a(k), 0<=k<10, n>=0.
a(n) = a(floor(n/10)) + a(n mod 10), n>=0.
a(n) = Sum_{j=0..m} a(floor(n/10^j) mod 10), n>=0.
a(A014261(n)) = floor(log_5(4n+1)), n>0.
G.f.: g(x) = (1/(1-x))*Sum_{j>=0} x^10^j/(1+x^10^j).
(End)
|
|
MAPLE
|
if n =0 then
0;
else
convert(n, base, 10) ;
add(d mod 2, d=%) ;
end if:
|
|
MATHEMATICA
|
Table[Total[Mod[IntegerDigits[n], 2]], {n, 0, 100}] (* Zak Seidov, Oct 13 2015 *)
|
|
PROG
|
(Haskell)
a196564 n = length [d | d <- show n, d `elem` "13579"]
(PARI) a(n) = #select(x->x%2, digits(n)); \\ Michel Marcus, Oct 14 2015
(Python)
def a(n): return sum(1 for d in str(n) if d in "13579")
|
|
CROSSREFS
|
Cf. A014261, A014263, A027868, A046034, A055640, A055641, A055642, A061217, A102669-A102685, A122640, A196563.
|
|
KEYWORD
|
nonn,easy,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|