login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A268643
Number of 1's in decimal representation of n.
25
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 1
OFFSET
0,12
LINKS
FORMULA
a(n) = a(floor(n/10)) + 1 if n == 1 (mod 10), otherwise a(n) = a(floor(n/10)).
G.f. g(x) satisfies g(x) = x/(1-x^10) + (1-x^10)*g(x^10)/(1-x).
MAPLE
f:= n -> numboccur(1, convert(n, base, 10)):
map(f, [$0..100]);
MATHEMATICA
DigitCount[Range[0, 120], 10, 1] (* Harvey P. Dale, Apr 08 2018 *)
PROG
(Python)
def A268643(n): return str(n).count('1') # Chai Wah Wu, Dec 23 2022
CROSSREFS
Second column of A100910.
Sequence in context: A172090 A037912 A056980 * A005094 A121372 A359432
KEYWORD
nonn,base
AUTHOR
Robert Israel, Feb 09 2016
STATUS
approved