cp's OEIS Frontend

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.

A094798 Number of times 1 is used in writing out all the numbers 1 through n.

This page as a plain text file.
%I A094798 #42 Oct 18 2023 02:13:45
%S A094798 1,1,1,1,1,1,1,1,1,2,4,5,6,7,8,9,10,11,12,12,13,13,13,13,13,13,13,13,
%T A094798 13,13,14,14,14,14,14,14,14,14,14,14,15,15,15,15,15,15,15,15,15,15,16,
%U A094798 16,16,16,16,16,16,16,16,16,17,17,17,17,17,17,17,17,17,17,18,18,18,18,18
%N A094798 Number of times 1 is used in writing out all the numbers 1 through n.
%C A094798 The number of 1's required to write all integers of n or fewer digits (i.e., the sequence a(9), a(99), a(999), ...) is 1, 20, 300, 4000, ..., which is A053541. - Jason D. W. Taff (jtaff(AT)jburroughs.org), Dec 05 2004
%C A094798 A014778 gives the fixed points. - _David Wasserman_, Feb 22 2005
%C A094798 Partial sums of A268643. - _Robert Israel_, Oct 28 2016
%H A094798 Harvey P. Dale, <a href="/A094798/b094798.txt">Table of n, a(n) for n = 1..1000</a>
%F A094798 G.f. g(x) satisfies g(x) = x/((1-x)*(1-x^10)) + ((1-x^10)/(1-x))^2*g(x^10). - _Robert Israel_, Oct 28 2016 [corrected by _Fabio VisonĂ _, Aug 10 2022]
%p A094798 nones:=proc(n) local nn,c,j: nn:=convert(n,base,10): c:=0: for j to nops(nn) do if nn[j]=1 then c:=c+1 else end if end do: c end proc: a:=proc(n) options operator, arrow: add(nones(k),k=1..n) end proc: seq(a(n),n=1..75); # _Emeric Deutsch_, Mar 01 2008
%p A094798 ListTools:-PartialSums([seq(numboccur(1,convert(n,base,10)),n=1..100)]); # _Robert Israel_, Oct 28 2016
%t A094798 Accumulate[Table[DigitCount[n,10,1],{n,80}]] (* _Harvey P. Dale_, Sep 27 2013 *)
%o A094798 (Python)
%o A094798 from itertools import accumulate, count, islice
%o A094798 def f(_, n): return _ + str(n).count("1")
%o A094798 def agen(): yield from accumulate(count(1), f)
%o A094798 print(list(islice(agen(), 75))) # _Michael S. Branicky_, Aug 09 2022
%o A094798 (PARI) a(n) = sum(k=1, n, #select(x->(x==1), digits(k))); \\ _Michel Marcus_, Oct 03 2023
%Y A094798 Cf. A014778, A053541, A268643.
%K A094798 easy,base,nonn
%O A094798 1,10
%A A094798 _Lekraj Beedassy_, Jun 11 2004